PEP 418: Fix time.highres() pseudo code

This commit is contained in:
Victor Stinner 2012-03-31 01:39:46 +02:00
parent 8e9a3c50ca
commit 53fa07dcc6
1 changed files with 10 additions and 30 deletions

View File

@ -172,14 +172,14 @@ It is available on all platforms and cannot fail.
Pseudo-code:: Pseudo-code::
def highres(): def highres():
if monotonic.use_performance_counter: if highres.use_performance_counter:
try: try:
return _time.QueryPerformanceCounter() return _time.QueryPerformanceCounter()
except OSError: except OSError:
# QueryPerformanceFrequency() may fail, if the installed # QueryPerformanceFrequency() may fail, if the installed
# hardware does not support a high-resolution performance # hardware does not support a high-resolution performance
# counter for example # counter for example
monotonic.use_performance_counter = False highres.use_performance_counter = False
if highres.use_monotonic: if highres.use_monotonic:
# Monotonic clock is preferred over system clock # Monotonic clock is preferred over system clock
try: try:
@ -194,13 +194,8 @@ Pseudo-code::
Clocks Clocks
====== ======
Monotonic Monotonic clocks
--------- ----------------
Summary
^^^^^^^
Table summarizing all monotonic clocks:
========================= =============== =============== ================ ==================== ========================= =============== =============== ================ ====================
Name Resolution Accuracy Adjusted by NTP? Action on suspend Name Resolution Accuracy Adjusted by NTP? Action on suspend
@ -215,11 +210,8 @@ GetTickCount[64]() 1 ms 1 ms - 15 ms No Inclu
timeGetTime() 1 ms 1 ms - 15 ms No ? timeGetTime() 1 ms 1 ms - 15 ms No ?
========================= =============== =============== ================ ==================== ========================= =============== =============== ================ ====================
(*) The accurary of monotonic clocks depends on the operating system. (*) The accurary of monotonic clocks depends on the operating system and the
hardware clock.
* Linux: ?
* FreeBSD: ?
* Solaris: ?
The resolution is the smallest difference between two timestamps supported by The resolution is the smallest difference between two timestamps supported by
the format used by the clock. For example, clock_gettime() uses a timespec the format used by the clock. For example, clock_gettime() uses a timespec
@ -420,16 +412,8 @@ Read the `gethrtime() manual page of Solaris 11
On Solaris, gethrtime() is the same as clock_gettime(CLOCK_MONOTONIC). On Solaris, gethrtime() is the same as clock_gettime(CLOCK_MONOTONIC).
System time System time clocks
----------- ------------------
The system time can be set manually by the system administrator or
automatically by a NTP daemon.
Summary
^^^^^^^
Table summarizing all system time clocks:
========================= =============== =============== ========================= =============== ===============
Name Resolution Accuracy Name Resolution Accuracy
@ -441,12 +425,8 @@ ftime() 1 ms (*)
time() 1 sec 1 sec time() 1 sec 1 sec
========================= =============== =============== ========================= =============== ===============
(*) The accurary of system clocks depends on the operating system. (*) The accurary of system clocks depends on the operating system and the
hardware clock. On Windows, the accuracy is in the range 1 ms - 15 ms.
* Windows: 1 ms - 15 ms
* Linux: ?
* Mac OS X: ?
* FreeBSD: ?
Windows: GetSystemTimeAsFileTime Windows: GetSystemTimeAsFileTime