mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-04 11:02:29 +00:00
Set timezone info when reading datetimes
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
This module contains the BinaryReader utility class.
|
||||
"""
|
||||
import os
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
from io import BufferedReader, BytesIO
|
||||
from struct import unpack
|
||||
|
||||
@@ -120,7 +120,10 @@ class BinaryReader:
|
||||
into a Python datetime object.
|
||||
"""
|
||||
value = self.read_int()
|
||||
return None if value == 0 else datetime.utcfromtimestamp(value)
|
||||
if value == 0:
|
||||
return None
|
||||
else:
|
||||
return datetime.fromtimestamp(value, tz=timezone.utc)
|
||||
|
||||
def tgread_object(self):
|
||||
"""Reads a Telegram object."""
|
||||
|
Reference in New Issue
Block a user