Skip to content

Commit 0fff347

Browse files
committed
[util] fix datetime deprecation warning
1 parent 99e9515 commit 0fff347

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

nixio/util/util.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import numpy as np
1010

1111
import h5py
12-
from datetime import datetime
12+
from datetime import datetime, timezone
1313
from uuid import uuid4, UUID
1414
from ..exceptions import exceptions
1515
from . import names
@@ -97,7 +97,8 @@ def time_to_str(time):
9797
:return: string in the form "YYYYMMDDTHHMMSS", where T is the date-time separator
9898
:rtype: str
9999
"""
100-
dt = datetime.utcfromtimestamp(time)
100+
# dt = datetime.utcfromtimestamp(time)
101+
dt = datetime.fromtimestamp(time, timezone.utc)
101102
return dt.strftime("%Y%m%dT%H%M%S").encode("utf-8")
102103

103104

0 commit comments

Comments
 (0)