[issue44831] Inconsistency between datetime.now() and datetime.fromtimestamp(time.time(), None)
Steven D'Aprano
report at bugs.python.org
Fri Aug 6 07:07:47 EDT 2021
Steven D'Aprano <steve+python at pearwood.info> added the comment:
I've replicated this under Linux as well.
def test():
start = time.time()
end = datetime.datetime.now()
start = datetime.datetime.fromtimestamp(start, None)
assert end >= start
Then run it in a loop:
>>> for i in range(10000000):
... test()
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "<stdin>", line 5, in test
AssertionError
>>> i
22
So while it is not as frequent as on Windows, it does occur on Linux as well.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44831>
_______________________________________
More information about the Python-bugs-list
mailing list