<div class="gmail_quote">On Wed, Feb 16, 2011 at 09:34, sturlamolden <span dir="ltr"><<a href="mailto:sturlamolden@yahoo.no">sturlamolden@yahoo.no</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On 16 Feb, 15:30, benhoyt <<a href="mailto:benh...@gmail.com">benh...@gmail.com</a>> wrote:<br>
<br>
> It seems to me that the logging module should use a millisecond-accurate timestamp (time.clock) on Windows, just like the "timeit" module does.<br>
<br>
</div>AFAIK, the Windows performance counter has long-term accuracy issues,<br>
so neither is perfect. Preferably we should have a timer with the long-<br>
term accuracy of time.time and the short-term accuracy of time.clock.<br>
<br>
Sturla</blockquote><div><br></div><div>I just uploaded a timer extension I wrote a while back which tries to solve some of this: <a href="http://pypi.python.org/pypi/timer">http://pypi.python.org/pypi/timer</a> (supports Python 2 and 3)</div>
<div><br></div><div>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 duration.</div>
<div><br></div><div>It appears to be fairly accurate so far, but I wouldn't count lives on it just yet.</div></div>