PEP 418: Add a table summarizing system clocks

This commit is contained in:
Victor Stinner 2012-03-30 23:16:06 +02:00
parent 5d38774ed5
commit 2e69f4914f
1 changed files with 36 additions and 5 deletions

View File

@ -185,20 +185,25 @@ Summary
Table summarizing all monotonic clocks:
========================= =============== =============== ================ ====================
Name Resolution Accuracy Adjusted by NTP? Action on suspend
========================= =============== =============== ================ ====================
CLOCK_MONOTONIC_RAW 1 ns ? No Stopped
gethrtime 1 ns ? No Not stopped
CLOCK_MONOTONIC_RAW 1 ns (*) No Stopped
gethrtime 1 ns (*) No Not stopped
CLOCK_HIGHRES 1 ns (*) No ?
CLOCK_MONOTONIC 1 ns (*) Yes on Linux Stopped on Linux
mach_absolute_time() 1 ns ? No ?
CLOCK_HIGHRES 1 ns ? No ?
CLOCK_MONOTONIC 1 ns ? Yes on Linux Stopped on Linux
QueryPerformanceCounter() \- 0.3 ns - 5 ns No Accuracy issue
GetTickCount[64]() 1 ms 1 ms - 15 ms No Include suspend time
timeGetTime() 1 ms 1 ms - 15 ms No ?
========================= =============== =============== ================ ====================
(*) The accurary of monotonic clocks depends on the operating system.
* Linux: ?
* FreeBSD: ?
* Solaris: ?
The resolution is the smallest difference between two timestamps supported by
the format used by the clock. For example, clock_gettime() uses a timespec
structure which has two integer fileds, tv_sec and tv_nsec, so the resolution
@ -401,6 +406,32 @@ On Solaris, gethrtime() is the same as clock_gettime(CLOCK_MONOTONIC).
System time
-----------
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
========================= =============== ===============
CLOCK_REALTIME 1 ns (*)
GetSystemTimeAsFileTime 100 ns 1 ms - 15 ms
gettimeofday() 1 µs (*)
ftime() 1 ms (*)
time() 1 sec 1 sec
========================= =============== ===============
(*) The accurary of system clocks depends on the operating system.
* Windows: 1 ms - 15 ms
* Linux: ?
* Mac OS X: ?
* FreeBSD: ?
Windows: GetSystemTimeAsFileTime
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^