[Python-Dev] PEP 418: Add monotonic clock (original) (raw)

Yury Selivanov yselivanov.ml at gmail.com
Wed Mar 28 16:27:26 CEST 2012


On 2012-03-28, at 10:17 AM, Nick Coghlan wrote:

def makemonotic: try: # Use underlying system monotonic clock if we can return monotonic except NameError: tick = time() def monotic(): newtick = time() if newtick > tick: tick = newtick return tick

monotonic = makemonotonic() Monotonicity of the result is thus ensured, even when using time.time() as a fallback.

What if system time jumps 1 year back? We'll have the same monotonic time returned for this whole year?

I don't think we should even try to emulate any of OS-level functionality.



More information about the Python-Dev mailing list