You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Add a code block here, if requiredimporttimefromdatetimeimportdatetimex1= (datetime.fromisoformat('2025-01-08T00:00:01') -datetime.utcnow()).secondstime.sleep(5)
x2= (datetime.fromisoformat('2025-01-08T00:00:01') -datetime.utcnow()).secondsprint(f"x1 should be less than x2, but x1={x1}, x2={x2}; x1<x2={x1<x2}")
CPython versions tested on:
3.12
Operating systems tested on:
Linux
The text was updated successfully, but these errors were encountered:
For me, it works as expected. Precision is a bit lost but it's still correct (the delta is 5 seconds, so it's a <= and not an exact <):
If you want to check < you should also consider the microseconds part.
picnixz
added
pending
The issue will be closed if no feedback is provided
and removed
type-bug
An unexpected behavior, bug, or error
labels
Jan 12, 2025
Bug report
Bug description:
Problem with datetime lib
CPython versions tested on:
3.12
Operating systems tested on:
Linux
The text was updated successfully, but these errors were encountered: