mirror of
https://github.com/chatmail/core.git
synced 2026-04-18 05:56:31 +03:00
python: use datetime.fromtimestamp() instead of datetime.utcfromtimestamp()
utcfromtimestamp() is not recommended by the official documentation, because many methods, including timestamp(), work incorrectly with "naive" datetimes returned by utcfromtimestamp().
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from .capi import lib
|
||||
from .capi import ffi
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
|
||||
|
||||
def as_dc_charpointer(obj):
|
||||
@@ -44,4 +44,4 @@ class DCLot:
|
||||
ts = lib.dc_lot_get_timestamp(self._dc_lot)
|
||||
if ts == 0:
|
||||
return None
|
||||
return datetime.utcfromtimestamp(ts)
|
||||
return datetime.fromtimestamp(ts, timezone.utc)
|
||||
|
||||
Reference in New Issue
Block a user