[Python-Dev] Rename time.steady(strict=True) to time.monotonic()? (original) (raw)

Victor Stinner victor.stinner at gmail.com
Sat Mar 24 00:25:41 CET 2012


Hi,

time.steady(strict=True) looks to be confusing for most people, some of them don't understand the purpose of the flag and others don't like a flag changing the behaviour of the function.

I propose to replace time.steady(strict=True) by time.monotonic(). That would avoid the need of an ugly NotImplementedError: if the OS has no monotonic clock, time.monotonic() will just not exist.

So we will have:

time.steady() is something like:

try: return time.monotonic() except (NotImplementError, OSError): return time.time()

time.time(), time.clock(), time.steady() are always available, whereas time.monotonic() will not be available on some platforms.

Victor



More information about the Python-Dev mailing list