Message304561
Marc Andre Lemburg: "time.cock() is used in a lot of code. Why can't we simply replace the functionality with one of the other functions ? The documentation certainly allows for such a change, since it pretty much just says that only the delta between two values has a meaning."
Currently time.clock() is the same clock than time.perf_counter() on Windows, but it's closer to CPU time as time.process_time() on Unix.
time.perf_counter() and time.process_time() have a different name because the they are different clocks and don't measure the same thing. The main obvious difference is that time.process_time() doesn't include time elapsed during sleep.
>>> import time
>>> c1=time.perf_counter(); p1=time.process_time(); time.sleep(1); c2=time.perf_counter(); p2=time.process_time()
>>> c2-c1, p2-p1
(1.0010841980038094, 7.308599999999998e-05)
I don't see how to modify clock() to make it behave the same on Windows and Unix without breaking any application which relies on the current clock() behaviour. |
|
Date |
User |
Action |
Args |
2017-10-18 08:28:00 | vstinner | set | recipients:
+ vstinner, lemburg, fdrake, belopolsky, benjamin.peterson, mrabarnett, benhoyt, ethan.furman, serhiy.storchaka |
2017-10-18 08:28:00 | vstinner | set | messageid: <1508315280.52.0.213398074469.issue31803@psf.upfronthosting.co.za> |
2017-10-18 08:28:00 | vstinner | link | issue31803 messages |
2017-10-18 08:28:00 | vstinner | create | |
|