-
Type: Task
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: 4.4
-
Component/s: None
Using utcnow and utcfromtimestamp is discouraged:
Warning Because naive datetime objects are treated by many datetime methods as local times, it is preferred to use aware datetimes to represent times in UTC. As such, the recommended way to create an object representing the current time in UTC is by calling datetime.now(timezone.utc).
https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow
They will likely be deprecated in 3.12: https://github.com/python/cpython/issues/103857
We should stop using these methods and audit our usage to make sure we don't suffer from the bugs they encourage.
- causes
-
PYTHON-3746 Test Failure - doctests NameError: name 'timezone' is not defined
- Closed
- is related to
-
MOTOR-1215 Stop using datetime.utcnow
- Closed
-
PYTHON-3849 [pymongocrypt] Address utcnow deprecation
- Closed