millisecond time accuracy

Tim Peters tim_one at email.msn.com
Sat Apr 24 00:42:18 EDT 1999


[Kevin F. Smith]
> 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?

[Andrew Kuchling]
> 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.

OTOH, so does time.clock(), which yields better-than-microsecond resolution
on most Windows + Intel systems (and where time.time() is much cruder).

Note that the Library Ref recommends time.clock() for benchmarking.

over-ten-years-a-nanosecond-here-or-there-doesn't-amount-to-much-
    more-than-a-microsecond-ly y'rs  - tim






More information about the Python-list mailing list