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/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