[Python-Dev] PEP 418: Add monotonic clock

Lennart Regebro regebro at gmail.com
Thu Mar 29 14:11:13 CEST 2012


On Wed, Mar 28, 2012 at 23:40, Victor Stinner <victor.stinner at gmail.com> wrote:
>> Does this primarily give a high resolution clock, or primarily a
>> monotonic clock? That's not clear from either the name, or the PEP.
>
> I expect a better resolution from time.monotonic() than time.time().

Sure. And for me that means that time.hires() would give a high
resolution version of time.time(). Ie, not monotonic, but wall clock.
The question then is why time.time() doesn't give that resolution from
the start.

It seems to me we need three functions: One to get the wall clock, one
to get a monotonic clock, and one that falls back if no monotonic
clock is available. Both time.time() and time.monotonic() should give
the highest resolution possible. As such, time.hires() seems
pointless.

//Lennart


More information about the Python-Dev mailing list