measuring 1/100th seconds, what function?

Peter Hansen peter at engcorp.com
Tue Aug 10 21:03:43 EDT 2004


Bengt Richter wrote:

> On windows I like to use time.clock()
[snip samples showing better resolution than time.time()]
> IOW, time apparently gets the NT4 basic os time slice delta (10ms),
> whereas clock tries to get something better (and it's pretty good).

All true, though the OP said he wanted code that would work on both
platforms (though Tim's response shows how trivial it is to
dynamically pick the best routine).

Presumably there's a human involved somewhere, plus a multitasking
OS with other things going on, and Python as well (not widely known
as a good hard realtime language ;-), so going for the extra
resolution of time.clock() is likely to be an exercise in higher
resolution, but no better accuracy...

-Peter



More information about the Python-list mailing list