I want to log how long something takes in real walltime. Currently I\'m doing this:
startTime = time.time()
someSQLOrSomething()
print \"That took %.3f secon
Here's how I get monotonic time in Python 2.7:
Install the monotonic package:
pip install monotonic
Then in Python:
import monotonic; mtime = monotonic.time.time #now mtime() can be used in place of time.time()
t0 = mtime()
#...do something
elapsed = mtime()-t0 #gives correct elapsed time, even if system clock changed.