Monotonic time in python

Python 2 and Python 3 < 3.3 need monotonic module from PyPI(pip) which provides a monotonic() function. It returns the value (in fractional seconds) of a system clock which never goes backwards.
On Python >= 3.3, monotonic will be an alias of time.monotonic from the standard library. On older versions, it will fall back to an equivalent implementation:

OS Function
Linux, BSD clock_gettime(3)
Windows GetTickCount or GetTickCount64
OS X mach_absolute_time

If no suitable implementation exists for the current platform, importing this module will cause a RuntimeError.

#python #time
menu 0
Ivan Borshchov profile picture
Nov 07, 2016
by Ivan Borshchov

Best related

Other by Ivan Borshchov