osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] PEP 410 (Decimal timestamp): the implementation is ready for a review


2012/2/14 Barry Warsaw <barry at python.org>:
> On Feb 13, 2012, at 07:33 PM, Victor Stinner wrote:
>
>>Oh, I forgot to mention my main concern about datetime: many functions
>>returning timestamp have an undefined starting point (an no timezone
>>information ), and so cannot be converted to datetime:
>> - time.clock(), time.wallclock(), time.monotonic(),
>>time.clock_gettime() (except for CLOCK_REALTIME)
>> - time.clock_getres()
>> - signal.get/setitimer()
>> - os.wait3(), os.wait4(), resource.getrusage()
>> - etc.
>
> That's not strictly true though, is it? ?E.g. clock_gettime() returns the
> number of seconds since the Epoch, which is a well-defined start time at least
> on *nix systems.

I mentionned the exception: time.clock_gettime(CLOCK_REALTIME) returns
an Epoch timestamp, but all other clocks supported by clock_gettime()
has an unspecified starting point:
- CLOCK_MONOTONIC
- CLOCK_MONOTONIC_RAW
- CLOCK_PROCESS_CPUTIME_ID
- CLOCK_THREAD_CPUTIME_ID

> ?So clearly those types of functions could return datetimes.

What? What would be the starting point for all these functions? It
would be surprising to get a datetime for CLOCK_PROCESS_CPUTIME_ID for
example.

> I'm fairly certain that between those types of functions and timedeltas you
> could have most of the bases covered.

Ah, timedelta case is different. But I already replied to Nick in this
thread about timedelta. You can also