Skip to content
Snippets Groups Projects
Commit ee12f8fd authored by KERDREUX Jerome's avatar KERDREUX Jerome
Browse files

Fix compatibility w/ older version

Older version of Py (3.8) doesn't have dateime.UTC.
parent dc72aa70
No related branches found
No related tags found
No related merge requests found
...@@ -342,8 +342,9 @@ def build_nonce(data: tuple) -> bytes: ...@@ -342,8 +342,9 @@ def build_nonce(data: tuple) -> bytes:
def build_timestamp() -> tuple: def build_timestamp() -> tuple:
"""Return array [seconds since epoch, microseconds since last seconds] Time = UTC+0000""" """Return array [seconds since epoch, microseconds since last seconds] Time = UTC+0000"""
epoch = datetime.datetime.fromtimestamp(0, datetime.UTC) utc = datetime.timezone.utc
timestamp = datetime.datetime.now(datetime.UTC) - epoch epoch = datetime.datetime.fromtimestamp(0, utc)
timestamp = datetime.datetime.now(utc) - epoch
return (int(timestamp.total_seconds()), int(timestamp.microseconds)) return (int(timestamp.total_seconds()), int(timestamp.microseconds))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment