Pythontime Module
[' _struct_tm_items ', ' __doc__ ', ' __loader__ ', ' __name__ ', ' __package__ ', ' __spec__ ', ' altzone ', ' asctime ', ' clock ', ' CTime ', ' Daylight ', ' get_clock_info ', ' gmtime ', ' localtime ', ' mktime ', ' monotonic ', ' perf_counter ', ' process_time ', ' Sleep ', ' strftime ', ' strptime ', ' struct_time ', ' time ', ' timezone ', ' tzname '
1.time ()
The core function of the time module is time (), which returns the number of seconds from the beginning of the era, the return value is a floating point, and the specific precision depends on the platform.
2.ctime ()
Floating-point numbers are typically used to store and compare dates, but not friendly to humans, and to record and print time, you can use CTime ().
3. Clock ()
Clock () returns the processor clock time, and its return value is typically used for performance testing and benchmarking. So they reflect the
The actual running time of the program.
4. Gmtime () and localtime ()
Gmtime () is used to get the UTC time, LocalTime () is used to get the current time zone, UTC time is actually Greenwich mean time, and it has a eight hour lag with China.
5. strptime ()
Used to convert string time to Struct_time format
6. strftime ()
Formatted output for TIME
7. mktime ()
A floating-point number that is used to convert struct_time into time
8. Sleep ()
The sleep function is used to hand over the current thread, asking it to wait for the system to wake it up again, and if the write program has only one thread, it will actually block the process and do nothing.
Python Time Module