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

Vincent Michel report at bugs.python.org
Mon Feb 3 09:19:38 EST 2020


Vincent Michel <vxgmichel at gmail.com> added the comment:

> The problem is that there is a double rounding in [...]

Actually `float(x) / 1e9` and `x / 1e9` seems to produce the same results:

```
import time
import itertools
now = time.time_ns()                                                                          
for x in itertools.count(now):
    assert float(x) / 1e9 == x / 1e9
```

> The formula `time = time_ns / 10**9` may be more accurate.

Well that seems to not be the case, see the plots and the corresponding code. I might have made a mistake though, please let me know if I got something wrong :)

----------

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


More information about the Python-bugs-list mailing list