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

Zachary Ware report at bugs.python.org
Wed Aug 14 16:47:45 EDT 2019


Zachary Ware <zachary.ware at gmail.com> added the comment:

Try this:

while time.process_time() < 0.5:
    print('.', flush=True, end='')

Or:

>>> time.process_time()
0.03125
>>> len(str(2**500_000))
150515
>>> time.process_time()
0.484375


Basically, process_time() (and process_time_ns()) measure CPU time used by the process, and you aren't making the CPU do anything between your checks.

----------
resolution: not a bug -> 
stage: resolved -> 
status: closed -> pending

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


More information about the Python-bugs-list mailing list