time in milliseconds by calling time.time()

Andre Engels andreengels at gmail.com
Sat Jul 25 07:47:14 CEST 2009


On Sat, Jul 25, 2009 at 3:27 AM, Roy Smith<roy at panix.com> wrote:

> Keep in mind that while a float may have a large apparent precision,
> there's no promise that the actual value returned by the OS has that much
> precision.  You should be fine if all you're looking for is ms, but I
> wouldn't count on much more than that.

Even stronger: I wouldn't count on _anything_ more than that. On my
machine, time.time() changes value once per millisecond. I tested this
by looking at a loop that recorded time.time() 100000 times. The total
time in the loop was 61 ms; out of the 100000 numbers, 61 were higher
than the previous one, with the highest difference being 1.00017 ms,
the lowest 0.999928 ms.

-- 
André Engels, andreengels at gmail.com



More information about the Python-list mailing list