STINNER Victor <victor.stin...@gmail.com> added the comment:

"Initially the time module was a thin wrapper around C and OS time-related 
functions. It may be confusing that the behavior of time.clock() differs from 
the behavior of C's clock()."

Well, there is the theory, and there is the practice. Someone decided to 
implement time.clock() with QueryPerformanceCounter() on Windows, and so 
time.clock() is no more a thin wrapper to the C clock() function since at least 
Python 2.7 (I didn't check earlier versions).

Portability on clocks is even more than complex than in the os module, 
especially when you want the same behaviour on Windows and Unix. The PEP 418 
added new clocks with a better defined behaviour to "fix" this issue.


"The documentation for clock() on MSDN suggests to use GetProcessTimes() for 
the behavior conforming the C standard."

time.process_time() is implemented with GetProcessTimes(). That's why 
time.clock() suggests to either replace it with time.perf_counter() or 
time.process_time().

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue31803>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to