PEP 418: Add time.get_clock_info()
This commit is contained in:
parent
196140e221
commit
e30d4d8b81
23
pep-0418.txt
23
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
|
||||
===============
|
||||
|
|
Loading…
Reference in New Issue