PEP 418: time.hires() uses time.monotonic() if available

hires() preference for clock_gettime() clocks:
CLOCK_MONOTONIC_RAW > CLOCK_MONOTONIC > CLOCK_REALTIME
This commit is contained in:
Victor Stinner 2012-03-27 19:50:13 +02:00
parent 4f31bacf76
commit 196e5a23ac
1 changed files with 2 additions and 0 deletions

View File

@ -144,6 +144,8 @@ Pseudo-code::
if os.name == 'nt':
def hires():
return _time.QueryPerformanceCounter()
elif hasattr(time, "monotonic"):
hires = time.monotonic
elif hasattr(time, "clock_gettime") and hasattr(time, "CLOCK_REALTIME"):
def hires():
return time.clock_gettime(time.CLOCK_REALTIME)