mirror of
https://github.com/Kozea/Radicale.git
synced 2025-08-07 18:30:54 +00:00
python < 3.11 support
This commit is contained in:
parent
0a6cc90e5f
commit
48ae4d1d6e
1 changed files with 4 additions and 1 deletions
|
@ -253,7 +253,10 @@ 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:
|
||||||
dt = datetime.datetime.fromtimestamp(unixtime, datetime.UTC)
|
if sys.version_info < (3, 11):
|
||||||
|
dt = datetime.datetime.utcfromtimestamp(unixtime)
|
||||||
|
else:
|
||||||
|
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:
|
||||||
r = str(unixtime) + "(>MAX:" + str(DATETIME_MAX_UNIXTIME) + ")"
|
r = str(unixtime) + "(>MAX:" + str(DATETIME_MAX_UNIXTIME) + ")"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue