[Python-Dev] PEP 418: Add monotonic clock

Scott Dial scott+python-dev at scottdial.com
Tue Mar 27 05:36:10 CEST 2012


On 3/26/2012 10:59 PM, Matt Joiner wrote:
> So does anyone care to dig into the libstd++/boost/windoze
> implementation to see how they each did steady_clock?

The Boost implementation can be summarized as:

system_clock:

  mac = gettimeofday
  posix = clock_gettime(CLOCK_REALTIME)
  win = GetSystemTimeAsFileTime

steady_clock:

  mac = mach_absolute_time
  posix = clock_gettime(CLOCK_MONOTONIC)
  win = QueryPerformanceCounter

high_resolution_clock:

  * = { steady_clock, if available
        system_clock, otherwise }

Whether or not these implementations meet the specification is an
exercise left to the reader..

-- 
Scott Dial
scott at scottdial.com


More information about the Python-Dev mailing list