Fix serialize_datetime (edits)

Forgot to wrap timedelta's seconds in `int()` on L135.
This commit is contained in:
ChoiHwaa 2022-06-14 22:29:05 +01:00 committed by GitHub
parent e65b7b0fd1
commit be6bb94e00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -123,6 +123,7 @@ class TLObject:
if not dt and not isinstance(dt, timedelta): if not dt and not isinstance(dt, timedelta):
return b'\0\0\0\0' return b'\0\0\0\0'
# We should use the time zone of the user.
try: try:
if isinstance(dt, datetime): if isinstance(dt, datetime):
dt = int(dt.timestamp()) dt = int(dt.timestamp())
@ -131,7 +132,7 @@ class TLObject:
elif isinstance(dt, float): elif isinstance(dt, float):
dt = int(dt) dt = int(dt)
elif isinstance(dt, timedelta): elif isinstance(dt, timedelta):
dt = dt.total_seconds() dt = int(dt.total_seconds())
except OSError: except OSError:
dt = 0 dt = 0