[Python-Dev] Drop the new time.wallclock() function? (original) (raw)

Guido van Rossum guido at python.org
Wed Mar 14 01:27:14 CET 2012


On Tue, Mar 13, 2012 at 4:57 PM, Victor Stinner <victor.stinner at gmail.com> wrote:

I added two functions to the time module in Python 3.3: wallclock() and monotonic(). I'm unable to explain the difference between these two functions, even if I wrote them :-) wallclock() is suppose to be more accurate than time() but has an unspecified starting point. monotonic() is similar except that it is monotonic: it cannot go backward. monotonic() may not be available or fail whereas wallclock() is available/work, but I think that the two functions are redundant.

I prefer to keep only monotonic() because it is not affected by system clock update and should help to fix issues on NTP update in functions implementing a timeout. What do you think?

I think wallclock() is an awkward name; in other contexts I've seen "wall clock time" used to mean the time that a clock on the wall would show, i.e. local time. This matches definition #1 of http://www.catb.org/jargon/html/W/wall-time.html (while yours matches #2 :-).

I agree that it's better to have only one of these. I also think if we offer it we should always have it -- if none of the implementations are available, I guess you could fall back on returning time.time(), with some suitable offset so people don't think it is always the same. Maybe it could be called realtime()?

-- --Guido van Rossum (python.org/~guido)



More information about the Python-Dev mailing list