[issue10278] add time.wallclock() method
report at bugs.python.org
Fri Jan 14 17:34:40 CET 2011
Brian Curtin <curtin at acm.org> added the comment:
> In Windows, it should probably use GetTickCount64 if available,
> otherwise GetTickCount with logic to handle wrapping. I think
> QueryPerformanceCounter is problematic as a general-purpose timer:
> depending on the hardware and Windows version, it can be offset
> differently across CPUs, and may not be reliable on some processors. It
> may be fixed in Vista or Win7, I'm not sure; if so it's much higher
> resolution than GTC.
I don't have a ton of experience with this, but by creating a synchronization point based on when the system clock changes, QueryPerformanceCounter can be pretty accurate and as you already stated, and higher resolution than most other solutions. http://msdn.microsoft.com/en-us/magazine/cc163996.aspx is where I got the idea and most of the implementation from. I'm essentially using the code from Figure 2 in a C extension right now to do something similar to threading.Timer in a performance testing tool.
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list