[issue23517] datetime.utcfromtimestamp parses timestamps incorrectly

STINNER Victor report at bugs.python.org
Sun Jul 5 12:42:37 CEST 2015


STINNER Victor added the comment:

Le vendredi 3 juillet 2015, Alexander Belopolsky <report at bugs.python.org> a
écrit :
>
> > UNIX doesn't like timestamps in the future
>
> I don't think this is a serious consideration.  The problematic scenario
> would be obtaining high-resolution timestamp (from say time.time()),
> converting it to datetime and passing it back to OS as a possibly 0.5µs
> higher value.  Given that timestamp -> datetime -> timestamp roundtrip by
> itself takes over 1µs, it is very unlikely that by the time rounded value
> hits the OS it is still in the future.
>

In many cases the resolution is 1 second. For example, a filesystem with a
resolution of 1second. Or an API only supporting a resolution of 1 second.

With a resoltuion of 1 second, timestamps in the future are likely (50%).

Sorry I don't remember all detail of timestamp rounding and all issues that
I saw.

----------

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


More information about the Python-bugs-list mailing list