You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.3 KiB

From: akuchlin at (Andrew M. Kuchling)
Date: Fri, 23 Apr 1999 14:04:16 -0400 (EDT)
Subject: millisecond time accuracy
In-Reply-To: <>
References: <>
Message-ID: <>
X-UID: 39
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
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
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"