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

Steven D'Aprano steve at pearwood.info
Fri Mar 16 00:18:44 CET 2012


Terry Reedy wrote:
> On 3/15/2012 5:27 PM, Alexander Belopolsky wrote:
>> On Thu, Mar 15, 2012 at 3:55 PM, Matt Joiner<anacrolix at gmail.com>  wrote:
>>> +1. I now prefer time.monotonic(), no flags.
>>
>> Am I alone thinking that an adjective is an odd choice for a function
>> name?
> 
> I would normally agree, but in this case, it is a function of a module 
> whose short name names what the adjective is modifying. I expect that 
> this will normally be called with the module name.
> 
>> I think monotonic_clock or monotonic_time would be a better option.
> 
> time.monotonic_time seems redundant.

Agreed. Same applies to "steady_time", and "steady" on its own is weird. 
Steady what?

While we're bike-shedding, I'll toss in another alternative. Early Apple 
Macintoshes had a system function that returned the time since last reboot 
measured in 1/60th of a second, called "the ticks".

If I have understood correctly, the monotonic timer will have similar 
properties: guaranteed monotonic, as accurate as the hardware can provide, but 
not directly translatable to real (wall-clock) time. (Wall clocks sometimes go 
backwards.)

The two functions are not quite identical: Mac "ticks" were 32-bit integers, 
not floating point numbers. But the use-cases seem to be the same.

time.ticks() seems right as a name to me. It suggests a steady heartbeat 
ticking along, without making any suggestion that it returns "the time".



-- 
Steven



More information about the Python-Dev mailing list