[Python-Dev] [RFC] PEP 418: Add monotonic time, performance counter and process time functions

Victor Stinner victor.stinner at gmail.com
Sat Apr 28 10:48:35 CEST 2012


> 3) The dict returned by get_clock_info includes an optional key,
> "is_adjusted". Why is it optional?

More complete answer.

Rules used to fill the is_adjusted flag:

 - System clock: is_adjusted=1 because the clock can be set manually
by the system administrator, except on Windows: is_adjusted is 0 if
GetSystemTimeAdjustment() returns isTimeAdjustmentDisabled=1
 - Process time: is_adjusted=0 because I don't know an OS where the
process time can be modified
 - Monotonic clocks: is_adjusted=0 on Windows, Mac OS X and Solaris,
is_adjusted=1 on Linux, it is not set otherwise. We may also set
is_adjusted to 0 on other OSes and so the key would not be optional
anymore.

Said differently, is_adjusted is only 1 for system clocks and for the
monotonic clock on Linux.

Victor


More information about the Python-Dev mailing list