[issue37859] time.process_time() constant / erratic on Windows

STINNER Victor report at bugs.python.org
Wed Aug 14 17:54:45 EDT 2019


STINNER Victor <vstinner at redhat.com> added the comment:

> I see that now. The behaviour was different in Linux, though, I suppose it may benefit from a more precise counter, but since in Windows it also has a precise counter with time.perf_counter_ns(), I was expecting to see that value change, but it was mainly a confusion with the older time.clock().

On Windows, time.clock() was implemented with QueryPerformanceCounter(). This function became time.perf_counter() in Python 3.4. time.clock() was removed. Use time.get_clock_info('perf_counter') ;-)

The PEP 418 introduces new well defined clocks, since time.clock() was not portable.

perf_counter and process_time have very different properties. process_time is stopped when the process sleeps, for example.

https://docs.python.org/dev/library/time.html#time.perf_counter
https://docs.python.org/dev/library/time.html#time.process_time

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37859>
_______________________________________


More information about the Python-bugs-list mailing list