[Python-checkins] peps: PEP 418: Add time.get_clock_info()

victor.stinner python-checkins at python.org
Sun Apr 1 04:24:04 CEST 2012


http://hg.python.org/peps/rev/7375d3178b6a
changeset:   4183:7375d3178b6a
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Sun Apr 01 04:11:08 2012 +0200
summary:
  PEP 418: Add time.get_clock_info()

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


diff --git a/pep-0418.txt b/pep-0418.txt
--- a/pep-0418.txt
+++ b/pep-0418.txt
@@ -13,8 +13,8 @@
 Abstract
 ========
 
-Add time.monotonic(fallback=True) and time.highres() functions to
-Python 3.3.
+Add time.monotonic(fallback=True), time.highres(), time.get_clock_info(name)
+functions to Python 3.3.
 
 
 Rationale
@@ -40,6 +40,7 @@
   clock is available, falls back to system clock by default, or raises
   an OSError if *fallback* is False.  time.monotonic(fallback=True)
   cannot go backward.
+* time.get_clock_info(name): get information on the specified time function
 
 
 time.time()
@@ -208,6 +209,24 @@
     highres.use_performance_counter = (os.name == 'nt')
     highres.use_monotonic = hasattr(time, 'monotonic')
 
+time.get_clock_info(name)
+-------------------------
+
+Get information on the specified time function as a dictionary. Only the following
+names are accepted:
+
+ * "clock": time.clock()
+ * "highres": time.highres()
+ * "monotonic": time.monotonic()
+ * "time": time.time()
+
+The following keys are always present:
+
+ * "function" (str): name of the underlying operating system function (ex:
+   "QueryPerformanceCounter()" or "clock_gettime(CLOCK_REALTIME)")
+ * "resolution" (float): resolution in seconds of the function
+ * "monotonic" (bool): True if the clock is monotonic
+
 
 Hardware clocks
 ===============

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


More information about the Python-checkins mailing list