python < 3.11 support
This commit is contained in:
@@ -253,6 +253,9 @@ def user_groups_as_string():
|
|||||||
|
|
||||||
def format_ut(unixtime: int) -> str:
|
def format_ut(unixtime: int) -> str:
|
||||||
if unixtime < DATETIME_MAX_UNIXTIME:
|
if unixtime < DATETIME_MAX_UNIXTIME:
|
||||||
|
if sys.version_info < (3, 11):
|
||||||
|
dt = datetime.datetime.utcfromtimestamp(unixtime)
|
||||||
|
else:
|
||||||
dt = datetime.datetime.fromtimestamp(unixtime, datetime.UTC)
|
dt = datetime.datetime.fromtimestamp(unixtime, datetime.UTC)
|
||||||
r = str(unixtime) + "(" + dt.strftime('%Y-%m-%dT%H:%M:%SZ') + ")"
|
r = str(unixtime) + "(" + dt.strftime('%Y-%m-%dT%H:%M:%SZ') + ")"
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user