[issue23517] datetime.utcfromtimestamp rounds results incorrectly

Tim Peters report at bugs.python.org
Sat Aug 29 00:31:59 CEST 2015


Tim Peters added the comment:

> Does your algorithm guarantee that any float that
> is displayed with 6 decimal places or less will
> convert to a datetime or timedelta with microseconds
> matching the fractional part?

No algorithm can, for datetimes far enough in the future (C doubles just plain run out of enough bits).

Apart from negative timestamps (which I didn't consider - they just blow up on my platform :-) ), the intent is to do the best that _can_ be done.

But _proving_ things in this area isn't simple, and there's no need for it:  check in a change to round the thing, and be done with it.  If Victor wants to rework rounding again, that's fine, but only under a _requirement_ that this particular bug remain fixed.  His change created the problem, and it's still languishing half a year after being reported - there's little sense in continuing to wait for him to do something about it.

----------

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


More information about the Python-bugs-list mailing list