Skip to content

Commit

Permalink
build: fix utcnow() replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
thebaptiste committed Nov 13, 2024
1 parent a0dd1cd commit 36aff39
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mfutil/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import psutil
import pickle
import hashlib
import datetime
from datetime import datetime, timezone
import time
import fnmatch

Expand Down Expand Up @@ -74,9 +74,9 @@ def get_utc_unix_timestamp():
# utcnow() is deprecated and should be replaced by now(datetime.UTC)
# (for python >= 3.11)
try:
dts = datetime.datetime.now(datetime.UTC)
dts = datetime.now(timezone.utc).replace(tzinfo=None)
except Exception:
dts = datetime.datetime.utcnow()
dts = datetime.utcnow()

return int(time.mktime(dts.timetuple()))

Expand Down

0 comments on commit 36aff39

Please sign in to comment.