[issue12904] Change os.utime &c functions to use nanosecond precision where possible

Larry Hastings report at bugs.python.org
Mon Sep 5 23:50:13 CEST 2011


Larry Hastings <larry at hastings.org> added the comment:

A small aside:

An IEEE 754 double is insufficient to store a modern timestamp with nanosecond accuracy.  We're currently at just over 1.3 billion seconds since the epoch.  This eats 28 bits of the mantissa.  (The value is actually 31 bits to the left of the decimal point, but you get the leading 1 and the subsequent two 0s for free.)  Precisely storing a billion values to the right of the decimal point would require another 30 bits.  The mantissa of a double is sadly only 52 bits.  So we're shy by 6 bits, give or take.

So this patch doesn't make Python 100% accurate with respect to atime/mtime.  What it *does* do is makes Python's loss of accuracy consistent.  I claim that's a definite improvement.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12904>
_______________________________________


More information about the Python-bugs-list mailing list