Title: Theory / Unimportant / CS / Programming / Python / Lib / time 16.3
Tags: FromInstruction computer_to_instruction hasNotNewEffectReturnsMeaning some_instruction
On every note of this deck, unless a note says otherwise:
Page: https://docs.python.org/3/library/time.html
Page: https://docs.python.org/3/library/time.html

Name: The epoch
Chapter: 16
Page: https://docs.python.org/3/library/time.html
Section: 3
Significative digit: On unix: January 1, 1970, 00:00:00 (UTC)
Represents2: The point where the time starts, and is platform
dependent.

Name: Seconds since the epoch
Definition: The total number of elapsed seconds since the epoch, typically excluding leap seconds
Chapter: 16
Section: 3

Name: Time limit in future
Chapter: 16
Page: https://docs.python.org/3/library/time.html
Represents: The moment at which the number of seconds since epoch cease to be representable by an int
Section: 3
Significative digit: Around 2038 on 32-bit Unix

Name: Coordinated Universal Time
Chapter: 16
Section: 3
Name2: Greenwich mean time
Abbreviation: UTC
Abbreviation2: GMT

Name: Daylight Saving Time
Definition: An adjustment of the timezone by (usually) one hour during part of the year.
Chapter: 16
Section: 3
Abbreviation: DST

Instruction: asctime(foo)
Language: Python
Context: time
Chapter: 16
Section: 3.1
Returns: A readable representation of current time, or of time given by the struct_time foo

Instruction: time.clock_getres(foo)
Effect: On unix: The resolution of the clock foo.
Language: Python
Chapter: 16
Section: 3.1

Instruction: time.clock_gettime(foo)
Effect: On unix: the time of the clock foo
Language: Python
Chapter: 16
Section: 3.1

Instruction: time.clock_settime(foo,bar)
Effect: On unix: set the time of the clock foo to bar
Language: Python
Chapter: 16
Section: 3.1

Instruction: time.get_clock_info(foo)
Effect: Get information on the clock foo as a namespace object.
Language: Python
Chapter: 16
Section: 3.1

Name: An adjustable clock
Definition: A clock which can be changed automatically (e.g. by
a NTP daemon) or manually by the system administrator
Chapter: 16
Section: 3.1

Name: The implementation of a clock
Definition: The name of the underlying C function used to get
the clock value.
Chapter: 16
Section: 3.1

Name: A monotonic clock
Definition: A clock which cannot go backward
Chapter: 16
Section: 3.1

Instruction: time.gmtime(foo)
Language: Python
Chapter: 16
Section: 3.1
Returns: Convert a time expressed in seconds since the epoch to a struct_time in UTC in which the dst flag is always zero. If secs is not provided or None, the current time as returned by time() is used. Fractions of a second are ignored.

Instruction: time.localtime(foo)
Language: Python
Chapter: 16
Section: 3.1
Returns: Like gmtime() but converts to local time. If secs is not provided or None, the current time as returned by time() is used. The dst flag is set to 1 when DST applies to the given time.

Instruction: time.mktime(foo)
Effect: This is the inverse function of localtime(). Its argument is the struct_time or full 9-tuple (since the dst flag is needed; use -1 as the dst flag if it is unknown) which expresses the time in local time, not UTC. It returns a floating point number, for compatibility with time(). If the input value cannot be represented as a valid time, either OverflowError or ValueError will be raised (which depends on whether the invalid value is caught by Python or the underlying C libraries). The earliest date for which it can generate a time is platform-dependent.
Language: Python
Chapter: 16
Section: 3.1

Instruction: time.monotonic()
Language: Python
Chapter: 16
Section: 3.1
Returns: The value (in fractional seconds) of a monotonic clock,
Extra: The clock is not affected by system clock updates. The reference point of the returned value is undefined, so that only the difference between the results of consecutive calls is valid.
On Windows versions older than Vista, monotonic() detects GetTickCount() integer overflow (32 bits, roll-over after 49.7 days). It increases an internal epoch (reference time) by 2^32 each time that an overflow is detected. The epoch is stored in the process-local state and so the value of monotonic() may be different in two Python processes running for more than 49 days. On more recent versions of Windows and on other operating systems, monotonic() is system-wide.

Instruction: time.perf_counter()
Language: Python
Chapter: 16
Section: 3.1
Returns: 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. The reference point of the returned value is undefined, so that only the difference between the results of consecutive calls is valid.

Instruction: time.process_time()
Language: Python
Chapter: 16
Section: 3.1
Returns: 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 reference point of the
returned value is undefined, so that only the difference between the results
of consecutive calls is valid.

Instruction: time.sleep()
Effect: Suspend execution of the calling thread for the given number of seconds. The argument may be a floating point number to indicate a more precise sleep time. The actual suspension time may be less than that requested because any caught signal will terminate the sleep() following execution of that signal’s catching routine. Also, the suspension time may be longer than requested by an arbitrary amount because of the scheduling of other activity in the system.
Changed in version 3.5: The function now sleeps at least secs even if the sleep is interrupted by a signal, except if the signal handler raises an exception (see PEP 475 for the rationale).
Language: Python
Chapter: 16
Section: 3.1

Instruction: time.strftime(format,foo)
Language: Python
Chapter: 16
Section: 3.1
Returns: Convert a tuple or struct_time representing a time as returned by gmtime() or localtime() to a string as specified by the format argument. If t is not provided, the current time as returned by localtime() is used. format must be a string.  ValueError is raised if any field in t is outside of the allowed range. 0 is a legal argument for any position in the time tuple; if it is normally illegal the value is forced to a correct one

Instruction: time.strptime(foo,bar)
Effect: Parse foo as a time according to format bar. By default "%a %b %d %H:%M:%S %Y". Raise ValueError if it cannot be parsed.
Language: Python
Chapter: 16
Section: 3.1

Instruction: time.ctime()
Effect: time.ctime(time())
Language: Python
Chapter: 16
Section: 3.1

Instruction: time.ctime(
NumberOfSecondSinceEpoch
)
Effect: Convert NumberOfSecondSinceEpoch to a string representing
local time
Language: Python
Chapter: 16
Section: 3.1
Variables: NumberOfSecondSinceEpoch