ANN: a new utility for Python developers

Tim Peters at
Sun Aug 19 21:22:45 CEST 2001

>>> ...
>>> - For timing, the clock() call in the windows CRT yields rather
>>>   innacurate data, so I had to use a Win32 call.

>> Note that *Python's* time.clock() on Windows uses the Win32
>> QueryPerformanceCounter() call, which has better than microsecond
>> resolution on virtually all Windows boxes.

> Yup, that's the call I'm using.  But initially I tried using the
> CRT clock() function (I seem to remember that this is the function
> used by the Python profiler).

I don't understand.  The Python profiler is written in Python, and uses
Python's time.clock(); it couldn't use a random C library function even if
it wanted to.  Python's time.clock() did call the msvcrt clock() on Windows
until early 1997, but has used QueryPerfomanceCouter() since then (ironic:
except on Win64!  QueryPerformanceCounter hadn't yet been implemented for
Win64 when Trent Mick did that port).

More information about the Python-list mailing list