[Python-Dev] PEP 418: Add monotonic clock (original) (raw)

Victor Stinner victor.stinner at gmail.com
Tue Mar 27 19:34:51 CEST 2012


I started to write the PEP 418 to clarify the notions of monotonic and steady clocks.

I replaced time.steady() by time.try_monotonic(). I misunderstood "may not" in the C++ doc: I understood it as "it may be adjusted by NTP", whereas it means "it cannot be adjusted". Sorry for the confusion.

I added a time.hires() clock because time.monotonic() and time.try_monotonic() are not the best clocks for profiling or benchmarking. For example, on Windows, time.hires() uses QueryPerformanceCounter() whereas time.monotonic() and time.try_monotonic() uses GetTickCount64.

I added the pseudo-code of each function. I hope that it is easier to understand than a long text.

Victor



More information about the Python-Dev mailing list