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

Antoine Pitrou solipsis at pitrou.net
Thu Feb 16 14:26:39 CET 2012


Le jeudi 16 février 2012 à 14:20 +0100, Victor Stinner a écrit :

> If I run your snippet and inspect modification times using stat, the > difference is much smaller (around 10 ns, not 1 ms): > > $ stat test | \grep Modify > Modify: 2012-02-16 13:51:25.643597139 +0100 > $ stat test2 | \grep Modify > Modify: 2012-02-16 13:51:25.643597126 +0100

The loss of precision is not constant: it depends on the timestamp value.

Well, I've tried several times and I can't reproduce a 1 ms difference.

The loss of precision is between 1 ms and 4 us.

It still looks fishy to me. IEEE doubles have a 52-bit mantissa. Since the integral part of a timestamp takes 32 bits or less, there are still 20 bits left for the fractional part: which allows for at least a 1 µs precision (220 ~= 106). A 1 ms precision loss looks like a bug.

Regards

Antoine.



More information about the Python-Dev mailing list