Message304502
The behaviour of the time.clock() function is not portable: on Windows it mesures wall-clock, whereas it measures CPU time on Unix. Python has time.process_time() and time.perf_counter(), since Python 3.3, which are portable, well defined and have a better resolution.
time.clock() was deprecated in Python 3.3 documentation, but calling time.clock() didn't raise a DeprecationWarning. I proposed to remove it from Python 3.7.
Sometimes, a deprecated function raises a DeprecationWarning in Python version N, before removing it from Python version N. time.clock() doesn't emit such warning, but I consider that it is possible to remove it anyway.
While it can be annoying to have to patch code to no more use time.clock(), I consider that it's worth it for portability and better clock resolution.
Attached PR removes time.clock() and time.get_clock_info() doens't accept 'clock' anymore.
Current time.clock() documentation:
----------------------------
.. function:: clock()
.. index::
single: CPU time
single: processor time
single: benchmarking
On Unix, return the current processor time as a floating point number expressed
in seconds. The precision, and in fact the very definition of the meaning of
"processor time", depends on that of the C function of the same name.
On Windows, this function returns wall-clock seconds elapsed since the first
call to this function, as a floating point number, based on the Win32 function
:c:func:`QueryPerformanceCounter`. The resolution is typically better than one
microsecond.
.. deprecated:: 3.3
The behaviour of this function depends on the platform: use
:func:`perf_counter` or :func:`process_time` instead, depending on your
requirements, to have a well defined behaviour.
---------------------------- |
|
Date |
User |
Action |
Args |
2017-10-17 13:00:45 | vstinner | set | recipients:
+ vstinner |
2017-10-17 13:00:45 | vstinner | set | messageid: <1508245245.67.0.213398074469.issue31803@psf.upfronthosting.co.za> |
2017-10-17 13:00:45 | vstinner | link | issue31803 messages |
2017-10-17 13:00:45 | vstinner | create | |
|