mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-01-24 08:14:14 +03:00
binary_reader: Parse TL 'date' to UTC datetime instead of local
This commit is contained in:
parent
7d4453351b
commit
f99d14558f
|
@ -113,7 +113,7 @@ class BinaryReader:
|
|||
into a Python datetime object
|
||||
"""
|
||||
value = self.read_int()
|
||||
return None if value == 0 else datetime.fromtimestamp(value)
|
||||
return None if value == 0 else datetime.utcfromtimestamp(value)
|
||||
|
||||
def tgread_object(self):
|
||||
"""Reads a Telegram object"""
|
||||
|
|
|
@ -36,7 +36,7 @@ class TLObject:
|
|||
', '.join(TLObject.pretty_format(x) for x in obj)
|
||||
)
|
||||
elif isinstance(obj, datetime):
|
||||
return 'datetime.fromtimestamp({})'.format(obj.timestamp())
|
||||
return 'datetime.utcfromtimestamp({})'.format(obj.timestamp())
|
||||
else:
|
||||
return repr(obj)
|
||||
else:
|
||||
|
@ -81,7 +81,7 @@ class TLObject:
|
|||
result.append(']')
|
||||
|
||||
elif isinstance(obj, datetime):
|
||||
result.append('datetime.fromtimestamp(')
|
||||
result.append('datetime.utcfromtimestamp(')
|
||||
result.append(repr(obj.timestamp()))
|
||||
result.append(')')
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user