From e30d4d8b81856704c3600eacb87db05467d9dc28 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sun, 1 Apr 2012 04:11:08 +0200 Subject: [PATCH] PEP 418: Add time.get_clock_info() --- pep-0418.txt | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/pep-0418.txt b/pep-0418.txt index 3c7f2147c..9d9dd89b3 100644 --- a/pep-0418.txt +++ b/pep-0418.txt @@ -13,8 +13,8 @@ Python-Version: 3.3 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 @@ To fulfill the use cases, the functions' properties are: 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 @@ Pseudo-code:: 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 ===============