You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use GetTickCount/GetTickCount64 instead of QueryPerformanceCounter for monotonic clock #58605
QueryPerformanceCounter() is not monotonic on a multiprocessor computer on Windows XP. Extract of its documentation:
"Remarks
On a multiprocessor computer, it should not matter which processor is called. However, you can get different results on different processors due to bugs in the basic input/output system (BIOS) or the hardware abstraction layer (HAL). To specify processor affinity for a thread, use the SetThreadAffinityMask function."
I vote for adding just one function to the 'time' module: monotonic(),
which should exist only if the host OS support it.
And I don't see the point of having 'steady()' at all.
loewis commented on Mar 24, 2012
loewismannequin
Mannequin
More actions
A monotonic clock is not suitable for measuring durations, as it may still jump forward. A steady clock will not.
YurySelivanov commented on Mar 24, 2012
YurySelivanovmannequin
Mannequin
More actions
A monotonic clock is not suitable for measuring durations, as it may still jump forward. A steady clock will not.
Well, Victor's implementation of 'steady()' is just a tiny wrapper, which uses 'monotonic()' or 'time()' if the former is not available. Hence 'steady()' is a misleading name.
> A monotonic clock is not suitable for measuring durations, as it may still jump forward. A steady clock will not.
Well, Victor's implementation of 'steady()' is just a tiny wrapper, which uses 'monotonic()' or 'time()' if the former is not available. Hence 'steady()' is a misleading name.
Activity
vstinner commentedon Mar 24, 2012
QueryPerformanceCounter() is not monotonic on a multiprocessor computer on Windows XP. Extract of its documentation:
"Remarks
On a multiprocessor computer, it should not matter which processor is called. However, you can get different results on different processors due to bugs in the basic input/output system (BIOS) or the hardware abstraction layer (HAL). To specify processor affinity for a thread, use the SetThreadAffinityMask function."
See also:
http://bytes.com/topic/python/answers/527849-time-clock-going-backwards
time.steady(strict-True) (or "time.monotonic()"? the function name is not decided yet :§)) should use GetTickCounter64(), or GetTickCounter().
GetTickCount64() was added to Windows Seven / Server 2008. GetTickCount() overflows after 49 days.
QueryPerformanceCounter() has a better resolution than
GetTickCount64 and so it's maybe better to keep it for time.steady(strict-False)?
YurySelivanov commentedon Mar 24, 2012
I vote for adding just one function to the 'time' module: monotonic(),
which should exist only if the host OS support it.
And I don't see the point of having 'steady()' at all.
loewis commentedon Mar 24, 2012
A monotonic clock is not suitable for measuring durations, as it may still jump forward. A steady clock will not.
YurySelivanov commentedon Mar 24, 2012
Well, Victor's implementation of 'steady()' is just a tiny wrapper, which uses 'monotonic()' or 'time()' if the former is not available. Hence 'steady()' is a misleading name.
malemburg commentedon Mar 25, 2012
Yury Selivanov wrote:
Agreed.
I think time.monotonic() is a better name.
vstinner commentedon Apr 4, 2012
I'm closing this issue as a duplicate... of the PEP-418. See the python-dev mailing list for discussions on this PEP.
python-dev commentedon Apr 29, 2012
New changeset 76d2e0761d18 by Victor Stinner in branch 'default':
Issue bpo-14428, bpo-14397: Implement the PEP-418
http://hg.python.org/cpython/rev/76d2e0761d18