mirror of
https://github.com/9001/copyparty.git
synced 2025-10-03 09:49:29 +02:00
utcfromtimestamp was deprecated and nobody told me,
not even the deprecationwarning that got silently generated burning 20~30% of all CPU-time without actually displaying it anywhere, nice python 3.12.0 is now only 5% slower than 3.11.6 also fixes some other, less-performance-fatal deprecations
This commit is contained in:
parent
a4bad62b60
commit
fc658e5b9e
16 changed files with 86 additions and 30 deletions
|
@ -7,7 +7,11 @@ import json
|
|||
import os
|
||||
import sys
|
||||
import time
|
||||
from datetime import datetime
|
||||
|
||||
try:
|
||||
from datetime import datetime, timezone
|
||||
except:
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
"""
|
||||
|
@ -96,7 +100,11 @@ def main(argv=None):
|
|||
msg_info = json.loads(sys.argv[1])
|
||||
# print(msg_info)
|
||||
|
||||
dt = datetime.utcfromtimestamp(msg_info["at"])
|
||||
try:
|
||||
dt = datetime.fromtimestamp(msg_info["at"], timezone.utc)
|
||||
except:
|
||||
dt = datetime.utcfromtimestamp(msg_info["at"])
|
||||
|
||||
msg_info["datetime"] = dt.strftime("%Y-%m-%d, %H:%M:%S")
|
||||
|
||||
msg_text = TEMPLATE % msg_info
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue