[issue31803] time.clock() should emit a DeprecationWarning

Marc-Andre Lemburg report at bugs.python.org
Sun Oct 22 09:16:24 EDT 2017


Marc-Andre Lemburg <mal at egenix.com> added the comment:

On 22.10.2017 15:14, Serhiy Storchaka wrote:
> 
> Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:
> 
> On non-Windows platforms clock() returns the processor time, perf_counter() does include time elapsed during sleep.
> 
>>>> import time
>>>> start = time.clock(); time.sleep(1); print(time.clock() - start)
> 9.700000000001374e-05
>>>> start = time.perf_counter(); time.sleep(1); print(time.perf_counter() - start)
> 1.000714950998372

Thanks for pointing that out. I didn't know.

Is there a different clock with similar accuracy we can use
to only count CPU time on Unix ?

----------

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


More information about the Python-bugs-list mailing list