logging module -- better timestamp accuracy on Windows
brian.curtin at gmail.com
Wed Feb 16 18:02:45 CET 2011
On Wed, Feb 16, 2011 at 09:34, sturlamolden <sturlamolden at yahoo.no> wrote:
> On 16 Feb, 15:30, benhoyt <benh... at gmail.com> wrote:
> > It seems to me that the logging module should use a millisecond-accurate
> timestamp (time.clock) on Windows, just like the "timeit" module does.
> AFAIK, the Windows performance counter has long-term accuracy issues,
> so neither is perfect. Preferably we should have a timer with the long-
> term accuracy of time.time and the short-term accuracy of time.clock.
I just uploaded a timer extension I wrote a while back which tries to solve
some of this: http://pypi.python.org/pypi/timer (supports Python 2 and 3)
It takes an idea from MSDN Magazine about creating reliable and accurate
high resolution timers and converts it into somewhat of a threading.Timer
replacement. It accepts a duration in microseconds and can be stopped,
giving you the current elapsed microseconds. I should add an infinite
argument so it can be used more like a stopwatch, rather than requiring a
It appears to be fairly accurate so far, but I wouldn't count lives on it
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list