[Python-Dev] an alternative to embedding policy in PEP 418

Cameron Simpson cs at zip.com.au
Fri Apr 6 02:48:12 CEST 2012

On 06Apr2012 08:51, I wrote:
| On 06Apr2012 00:27, Victor Stinner <victor.stinner at gmail.com> wrote:
| | By the way, I removed ("deferred") the time.highres() function from the 
| | PEP,
| Chuckle; was not the whole PEP for a high res clock?

Gah. I see it was for montonic, not high res. Sorry.

| I can think of definitions of "steady" that I personally would accept,
| and they'd accept that suspend/resume would be concealed (I guess I
| would usually want - purely myself here - a clock representing system
| run time; I'd go for time.time() for wall clock).
| | So which flags do you want to support? (only "monotonic"?)
| I'd stay with my current list, with metadata in the clock objects
| indicating what _flavour_ of "steady" or "high res" they present.

On reflection, since I have historically presumed time.time() on UNIX
mapped to "man 2 time", I clearly think that time.time() is wall clock
time, and may jump when the sysadmin notices it is incorrect (of course
this is often mediated by NTP, which in turn is usually mediated by
some ntpd using adjtime(), which slews instead of jumping). But it might
jump. (I'm intending to jump a wayard VM today, in fact:-)

So guess I expect time.time() to be only usually steady. And usually
monotonic. So having neither flag. Do I want a WALLCLOCK flag? Meaning a
clock that is supposed to be real world time (did I see REALTIME in one
of your examples?), and may be almost arbirarily corrected to be made
real world if it is wrong. Maybe. +0 on that I think.

Basicly I'm distinguishing here between a clock used for timestamps, for
example in log entries, and a clock used for measuring elapsed system
run time, for example in benchmarking. I would want to log entries to
match what a clock on the wall should say.

So I think I'm _still_ for the three original flags I suggested
(monotonic, high res, steady) and expect time.time() to not necessarily
meet any of them. But to meet a hypothetical WALLCLOCK flag.

Regarding UNIX time(2) (or POSIX time(3)), POSIX says:

  The time() function shall return the value of time   in  seconds since
  the Epoch.

and the epoch is a date. So UNIX time() should be a wall clock.
Python "help(time.time)" says:

  Return the current time in seconds since the Epoch.

So I think it should also be a wall clock by that same reasoning.

Cameron Simpson <cs at zip.com.au> DoD#743

Uh, this is only temporary...unless it works.   - Red Green

More information about the Python-Dev mailing list