[Python-Dev] PEP 418: Add monotonic clock
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 _make_monotic:
> try:
> # Use underlying system monotonic clock if we can
> return _monotonic
> except NameError:
> _tick = time()
> def monotic():
> _new_tick = time()
> if _new_tick > _tick:
> _tick = _new_tick
> return _tick
>
> monotonic = _make_monotonic()
>
> 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.
-
Yury
More information about the Python-Dev
mailing list