[Python-Dev] [RFC] PEP 418: Add monotonic time, performance counter and process time functions
Guido van Rossum
guido at python.org
Sat Apr 28 17:57:05 CEST 2012
On Sat, Apr 28, 2012 at 7:51 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> On Sat, 28 Apr 2012 07:02:13 -0700
> Guido van Rossum <guido at python.org> wrote:
>> >
>> > It is this function:
>> > http://docs.python.org/dev/library/time.html#time.clock_gettime
>> >
>> > It's just a binding of the C function clock_gettime(). Should the PEP
>> > describe all functions used by the PEP?
>>
>> Oh, now I'm confused. Se in 3.3 we're adding a bunch of other new
>> functions to the time module that aren't described by the PEP? Aren't
>> those functions redundant? Or did I miss some part of the conversation
>> where this was discussed? What's *their* history?
>
> time.clock_gettime() (and the related constants
> CLOCK_{REALTIME,MONOTONIC, etc.}) is a thin wrapper around the
> corresponding POSIX function, it's there for people who want low-level
> control over their choice of APIs:
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_gettime.html
>
> As a thin wrapper, adding it to the time module was pretty much
> uncontroversial, I think. The PEP proposes cross-platform
> functions with consistent semantics, which is where a discussion was
> needed.
True, but does this mean clock_gettime and friends only exist on
POSIX? Shouldn't they be in the os or posix module then? I guess I'm
fine with either place but I don't know if enough thought was put into
the decision. Up until now the time module had only cross-platform
functions (even if clock()'s semantics vary widely).
--
--Guido van Rossum (python.org/~guido)
More information about the Python-Dev
mailing list