[Python-checkins] peps: PEP 418: time.hires() uses time.monotonic() if available

victor.stinner python-checkins at python.org
Tue Mar 27 19:49:55 CEST 2012


http://hg.python.org/peps/rev/b9e7d7ec8da4
changeset:   4156:b9e7d7ec8da4
user:        Victor Stinner <vstinner at wyplay.com>
date:        Tue Mar 27 19:50:13 2012 +0200
summary:
  PEP 418: time.hires() uses time.monotonic() if available

hires() preference for clock_gettime() clocks:
CLOCK_MONOTONIC_RAW > CLOCK_MONOTONIC > CLOCK_REALTIME

files:
  pep-0418.txt |  2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)


diff --git a/pep-0418.txt b/pep-0418.txt
--- a/pep-0418.txt
+++ b/pep-0418.txt
@@ -144,6 +144,8 @@
     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)

-- 
Repository URL: http://hg.python.org/peps


More information about the Python-checkins mailing list