[Python-Dev] PEP 418 glossary

Victor Stinner victor.stinner at gmail.com
Sat Apr 14 01:36:17 CEST 2012

By the way, I hesitate to add a new mandatory key to
time.get_clock_info() which indicates if the clock includes time
elapsed during a sleep. Is "is_realtime" a good name for such flag?

time.get_clock_info('time')['is_realtime'] == True
time.get_clock_info('monotonic')['is_realtime'] == True
time.get_clock_info('process_time')['is_realtime'] == False
time.get_clock_info('clock')['is_realtime'] == True on Windows, False on Unix
time.get_clock_info('perf_counter')['is_realtime'] == True on Windows
and GNU/Hurd (which will use gettimeofday()), False on Unix. It may
vary depending on which clocks are available.

Another candidate for a new optional key is a flag indicating if the
clock includes time elapsed during system suspend. I don't know how to
call such key. Let's call it "include_suspend". Examples:

time.get_clock_info('time')['include_suspend'] == True
time.get_clock_info('monotonic')['include_suspend'] == True on
Windows, False on Mac OS X, Linux and FreeBSD
time.get_clock_info('perf_counter')['include_suspend'] == False on Mac
OS X, Linux and FreeBSD. It is not set on Windows, until someone tells
me how QueryPerformanceCounter() behaves on suspend :-)
time.get_clock_info('process_time')['include_suspend'] == ??? (not set?)
time.get_clock_info('clock')['include_suspend'] == ??? (not set?)


2012/4/12 R. David Murray <rdmurray at bitdance.com>:
> On Thu, 12 Apr 2012 13:49:43 -0000, =?utf-8?B?S3Jpc3Rqw6FuIFZhbHVyIErDs25zc29u?= <kristjan at ccpgames.com> wrote:
>> Wallclock:  This definition is wrong no metter how the BDFL feels about the word.  Please see http://en.wikipedia.org/wiki/Wall_clock_time.
> I agree with the BDFL.  I have always heard "wallclock" as referring to
> the clock on the wall (that's what the words mean, after all).
> When this term became current that meant an *analog* clock that did not
> automatically update for daylight savings time, so naturally if you
> measure an interval using it it is equivalent to "real time".
> However, to my mind the implication of the term has always been that
> the actual time value returned by a 'wallclock' function can be directly
> mapped to the time shown on the clock on the wall (assuming the computer's
> clock and the clock on the wall are synchronized, of course).
> Heh.  Come to think of it, when I first encountered the term it was in
> the context of one of the early IBM PCs running DOS, which means that
> the computer clock *was* set to the same time as the wall clock.
> Thus regardless of what Wikipedia thinks, I think in many people's
> minds there is an inherent ambiguity in what the term means.   If you
> use it to measure an interval, then I think most people would agree
> automatically that it is equivalent to "real time".  But outside of
> interval measurement, there is ambiguity.
> So I think the definition in the PEP is correct.
> --David

More information about the Python-Dev mailing list