time Module in Python 3 Standard Library
According to 16.3. time — Time access and conversions
https://docs.python.org/3/library/time.html
1 | This module provides various time-related functions. |
Or you can say in this module there are
1 | Functions for manipulating clock time. |
as in the PYMOTW-3
https://pymotw.com/3/time/index.html
I am not going to list every function available in the ‘time’ module, only the core functions such as time(), etc.
1 | import time |
You would see number of seconds since the start of the “epoch” as a floating point value, e.g. 1491220050.174642.
1 | time.ctime() # 'Mon Apr 3 19:49:02 2017' |
Only the difference between the results of consecutive calls is valid. The same applies to time.perf_counter() and time.process_time()
1 | time.gmtime() |
time.struct_time(tm_year=2017, tm_mon=4, tm_mday=3, tm_hour=12, tm_min=3, tm_sec=33, tm_wday=0, tm_yday=93, tm_isdst=0)
1 | time.gmtime().tm_year # 2017 |
Return the value (in fractional seconds) of a performance counter, i.e. a clock with the highest available resolution to measure a short duration. It does include time elapsed during sleep and is system-wide.
1 | time.process_time() |
Return the value (in fractional seconds) of the sum of the system and user CPU time of the current process. It does not include time elapsed during sleep. It is process-wide by definition.
The above should be enough for now.