[Python-Dev] datetime nanosecond support

Christian Heimes lists at cheimes.de
Wed Jul 25 16:11:25 CEST 2012


Am 25.07.2012 14:11, schrieb Nick Coghlan:
> 1. For the reasons presented, I think it's worth attempting to define
> a common API that is based on datetime, but is tailored towards high
> precision time operations (at least using a different internal
> representation, perhaps supporting TAI).

This is a great opportunity to implement two requests at once. Some
people want high precision datetime objects while others would like to
see a datetime implementation that works with dates BC.

>>> from datetime import datetime, timedelta
>>> epoch = datetime.datetime(1970, 1, 1)
>>> epoc - timedelta(days=1969*365.242)
datetime.datetime(1, 1, 1, 12, 2, 52, 799998)
>>> epoch - timedelta(days=1970*365.242)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: date value out of range


> 2. I don't think the stdlib is the right place to define the initial
> version of this. 

+1



More information about the Python-Dev mailing list