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.time(): realtime, can be adjusted by the system administrator
(manually) or automatically by NTP
- time.clock(): monotonic clock on Windows, CPU time on UNIX
- time.monotonic(): monotonic clock, its speed may or may not be
adjusted by NTP but it only goes forward, may raise an OSError
- time.steady(): monotonic clock or the realtime clock, depending on
what is available on the platform (use monotonic in priority). may be
adjusted by NTP or the system administrator, may go backward.

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
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to