fuad fuad - 1 year ago 174
Python Question

High-precision clock in Python

Is there a way to measure time with high-precision in Python --- more precise than one second? I doubt that there is a cross-platform way of doing that; I'm interesting in high precision time on Unix, particularly Solaris running on a Sun SPARC machine.

timeit seems to be capable of high-precision time measurement, but rather than measure how long a code snippet takes, I'd like to directly access the time values.

daf daf
Answer Source

You can simply use the standard time module:

>>> import time
>>> time.time()
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download