Fix negative timestamp issue

Some timestamps can be negative, and anything lower than -43200 throws OSError. Handle that by changing the `value == 0` check to `value <= 0`
This commit is contained in:
binares 2019-07-24 17:44:48 +03:00 committed by GitHub
parent de85c34462
commit 14b1226066
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -120,7 +120,7 @@ class BinaryReader:
into a Python datetime object.
"""
value = self.read_int()
if value == 0:
if value <= 0:
return None
else:
return datetime.fromtimestamp(value, tz=timezone.utc)