[Python-Dev] Drop the new time.wallclock() function?
Victor Stinner
victor.stinner at gmail.com
Wed Mar 14 00:57:16 CET 2012
More information about the Python-Dev mailing list
Wed Mar 14 00:57:16 CET 2012
- Previous message: [Python-Dev] making python's c iterators picklable (http://bugs.python.org/issue14288)
- Next message: [Python-Dev] Drop the new time.wallclock() function?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi, 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? -- monotonic() has 3 implementations: * Windows: QueryPerformanceCounter() with QueryPerformanceFrequency() * Mac OS X: mach_absolute_time() with mach_timebase_info() * UNIX: clock_gettime(CLOCK_MONOTONIC_RAW) or clock_gettime(CLOCK_MONOTONIC) wallclock() has 3 implementations: * Windows: QueryPerformanceCounter() with QueryPerformanceFrequency(), with a fallback to GetSystemTimeAsFileTime() if QueryPerformanceFrequency() failed * UNIX: clock_gettime(CLOCK_MONOTONIC_RAW), clock_gettime(CLOCK_MONOTONIC) or clock_gettime(CLOCK_REALTIME), with a fallback to gettimeofday() if clock_gettime(*) failed * Otherwise: gettimeofday() (wallclock should also use mach_absolute_time() on Mac OS X) Victor
- Previous message: [Python-Dev] making python's c iterators picklable (http://bugs.python.org/issue14288)
- Next message: [Python-Dev] Drop the new time.wallclock() function?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list