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

Victor Stinner victor.stinner at gmail.com
Thu Feb 16 13:15:08 CET 2012


2012/2/15 Guido van Rossum <guido at python.org>:
> So using floats we can match 100ns precision, right?

Nope, not to store an Epoch timestamp newer than january 1987:

>>> x=2**29; (x+1e-7) != x # no loss of precision
True
>>> x=2**30; (x+1e-7) != x # lose precision
False
>>> print(datetime.timedelta(seconds=2**29))
6213 days, 18:48:32
>>> print(datetime.datetime.fromtimestamp(2**29))
1987-01-05 19:48:32

Victor


More information about the Python-Dev mailing list