millisecond time accuracy
Andrew M. Kuchling
akuchlin at cnri.reston.va.us
Fri Apr 23 14:04:16 EDT 1999
Kevin F. Smith writes:
>Is there a way to measure time accurate to milliseconds?
>
>For example, by calling the time.time() function I get seconds. Is
>there a comparable function that I could use to measure interval times
>down to at least millisecond accuracy?
Nothing portable. However, time.time() actually returns a
floating point number, and the Python implementation tries to use the
most precise function available in the C library. If your system
supports gettimeofday(), which has microsecond resolution, then
time.time() will return a floating point number with microsecond
precision.
Note that precision is not the same as accuracy! Python just
uses the C library, so the accuracy or lack thereof is up to the
library implementation.
--
A.M. Kuchling http://starship.python.net/crew/amk/
They dreamed the world so it always was the way it is now, little one. There
never was a world of high cat-ladies and cat-lords.
-- Dream, in SANDMAN #18: "A Dream of a Thousand Cats"
More information about the Python-list
mailing list