wasm-demo/demo/ermis-f/python_m/cur/0039

36 lines
1.3 KiB
Plaintext

From: akuchlin at cnri.reston.va.us (Andrew M. Kuchling)
Date: Fri, 23 Apr 1999 14:04:16 -0400 (EDT)
Subject: millisecond time accuracy
In-Reply-To: <3720A4A6.125DA1C7@OMIT_THIS.us.ibm.com>
References: <3720A4A6.125DA1C7@OMIT_THIS.us.ibm.com>
Message-ID: <14112.46141.974182.785300@amarok.cnri.reston.va.us>
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
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"