Getting milliseconds in Python

Fredrik Lundh fredrik at pythonware.com
Wed Feb 16 12:40:15 EST 2005


"mjs7231" <mjs7231 at gmail.com> wrote:

> "Return the time as a floating point number expressed in seconds since
> the epoch, in UTC. Note that even though the time is always returned as
> a floating point number, not all systems provide time with a better
> precision than 1 second. While this function normally returns
> non-decreasing values, it can return a lower value than a previous call
> if the system clock has been set back between the two calls. "
>
> This is no good, I am looking for milliseconds, not seconds.. as stated
> above.

are you sure you know what a millisecond is?

can you spot the milliseconds here:

>>> import time
>>> time.time()
1108575508.234
>>> time.time()
1108575515.062

or here:

>>> time.clock()
1.6349019714375455
>>> time.clock()
2.2402415685960024
>>> time.clock()
2.7715522631434739

</F> 






More information about the Python-list mailing list