Wilbert's website at SocSci

has a subtitle

computer/timeResolution.html 2014-08-18

Computer clock resolution.

Linux has a kernel clock which ticks at 1000 Hz. Interrupts can therefore be scheduled with this resolution. The Python time.time() function returns time with a resolution of 1 μs.

Unfortunately this is not true for Microsoft operating systems. The resolution of the time.time() function is equal to that of the interrupt timer.

Microsoft DOS used to have a timer resolution of approximately 55 ms (≈ 18.2 Hz). Timer resolution in Windows XP was 15.625 ms (64 Hz).

Default timer resolution on Windows 7 is 15.60 ms. However each program can request a faster clock. If any program wants a faster clock, the fastest clock will be used. The fastest timer possible is 1 ms. Microsoft warns for a 25% increase in power consumption of the whole computer in this situation.

Use timeResolution.py to test your time function resolution. On Windows systems it will give both the default and the best resolution.

Use time.clock on MS systems to get an accurate time. This is time since process start however. There is no way to get accurate wall clock time in MS.

Links

  • http://tdistler.com/2010/06/27/high-performance-timing-on-linux-windows
  • http://download.microsoft.com/download/3/0/2/3027D574-C433-412A-A8B6-5E0A75D5B237/Timer-Resolution.docx
  • http://stackoverflow.com/questions/240058/1ms-resolution-timer-under-linux-recommended-way
  • http://www.6test.edu.cn/~lujx/linux_networking/0131777203_ch02lev1sec7.html