Skip to content

Replace deprecated call to datetime.utcfromtimestamp #603

@cdce8p

Description

@cdce8p

Proposal:
Starting with Python 3.12 datetime.utcfromtimestamp will be deprecated in favor of the timezone aware datetime.fromtimestamp. https://docs.python.org/3.12/library/datetime.html#datetime.datetime.utcfromtimestamp
AFAICT this only effects one instance in the active (excluding examples) code base and the fix should be pretty simple

EPOCH = datetime.utcfromtimestamp(0).replace(tzinfo=timezone.utc)

-    EPOCH = datetime.utcfromtimestamp(0).replace(tzinfo=timezone.utc)
+    EPOCH = datetime.fromtimestamp(0, tz=timezone.utc)

Note: datetime.utcnow() will also be deprecated in favor of datetime.now(tz=timezone.utc) but that's only used in examples or tests. https://docs.python.org/3.12/library/datetime.html#datetime.datetime.utcnow

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions