hundreds of seconds?

Blair P. Houghton blair.houghton at
Thu Oct 12 06:30:16 CEST 2006

Tim Peters wrote:
> On Windows 98, time.time() typically updates only once per 0.055
> seconds (18.2 Hz), but time.clock() typically updates more than a
> million times per second.  You do /not/ want to use time.time() for
> sub-second time measurement on Windows.  Use time.clock() for this
> purpose on Windows.

Windows is not a real-time operating system.

Let me say that again:

Windows is not a real-time operating system.

The times you get from those functions will not always be
"the time I called the function".

They will always be "some time between the time
I called the function and it returned".

The difference being, sometimes when you call a function
it takes a lot longer to return because Windows has gone
and done something else unrelated to your program for
several seconds in-between.

You can reduce how often this happens by jacking up
the process priority for your program, but it never goes
away completely, and, because Windows is not a real-
time operating system, you can not predict with certainty
when these delays will occur and how long they will be.

Which may or may not matter, but people were talking
about trusting the number of bits in a floating-point
number to tell them the precision of the clock, so I
figured I should clear up another misconception while
they were learning not to do that, too...


More information about the Python-list mailing list