How can I get wall-time in Python using the standard library?
This question, and this question suggests that something like clock_gettime(CLOCK_MONOTONIC_RAW) or /proc/uptime most suitable for Linux. On Windows, time.clock() has the desired effect.
clock_gettime(CLOCK_MONOTONIC_RAW)
/proc/uptime
time.clock()
I would use time.time() , but the function does not guarantee a monotonous (and linear) return by increasing the time values.
time.time()
Victor Steiner wrote a Python monotone timer implementation . See http://bugs.python.org/issue10278 for a discussion and documents for the upcoming version 3.3 link to a new feature (C encoded).
There is also Monoclock :
Monoclock is a Python module that provides access to monotonous clocks on POSIX-like operating systems that have librt .Compatibility: tested on CPython 2.6.5, CPython 2.7, pypy 1.3, and pypy 1.4.
Monoclock is a Python module that provides access to monotonous clocks on POSIX-like operating systems that have librt .
librt
Compatibility: tested on CPython 2.6.5, CPython 2.7, pypy 1.3, and pypy 1.4.