[Python-Dev] this is why we shouldn't call it a "monotonic clock" (was: PEP 418 is too divisive and confusing and should be postponed)

Victor Stinner victor.stinner at gmail.com
Mon Apr 9 13:26:30 CEST 2012


> |  * time.process_time(): High-resolution (?) per-process timer from the
> | CPU. (other possible names: time.process_cpu_time() or
> | time.cpu_time())
>
> POSIX offers CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID that
> seem to suit this need, depending on your threading situation (and what
> you're measuring).

Yep.

> | On Windows, GetProcessTimes() has not a "high-resolution": it has a
> | accuracy of 1 ms in the best case.
>
> This page:
>  http://msdn.microsoft.com/en-us/library/windows/desktop/ms683223%28v=vs.85%29.aspx
> says "100-nanosecond time units".
>
> Am I going to the wrong place to learn about these functions?

Yes, the resolution is 100 ns, but the accuracy is only 1 ms in the
best case (but it usually 15 ms or 10 ms).

Resolution != accuracy, and only accuracy matters :-)
http://www.python.org/dev/peps/pep-0418/#resolution

Victor


More information about the Python-Dev mailing list