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 backward.

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, BSDclock_gettime(3)
  • Windows GetTickCount or GetTickCount64
  • OS Xmach_absolute_time

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

Image for a hint