[issue39484] time_ns() and time() cannot be compared on windows

Mark Dickinson report at bugs.python.org
Sun Feb 9 10:28:09 EST 2020


Mark Dickinson <dickinsm at gmail.com> added the comment:

Here's another way to see it. Let's get the Unix timestamp for right now:

>>> from datetime import datetime
>>> epoch = datetime(1970, 1, 1)
>>> now = (datetime.now() - epoch).total_seconds()
>>> now
1581261916.910558

Now let's figure out the resolution, by taking the next float up from that value and subtracting.

>>> from math import nextafter, inf
>>> nextafter(now, inf) - now
2.384185791015625e-07

That's 2**-22, or a little bit less than a quarter of a microsecond. We're out from our desired resolution (1ns) by a factor of ~239, so it's going to take another 8 bits (factor of 256) to get us there.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39484>
_______________________________________


More information about the Python-bugs-list mailing list