mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-22 03:33:08 +00:00
Merge pull request #745 from JonnyWong16/bugfix/to_datetime
Limit datetime attributes to max 32-bit integer timestamp
This commit is contained in:
commit
6e92be6a7a
1 changed files with 2 additions and 3 deletions
|
@ -200,9 +200,8 @@ def toDatetime(value, format=None):
|
|||
else:
|
||||
# https://bugs.python.org/issue30684
|
||||
# And platform support for before epoch seems to be flaky.
|
||||
# TODO check for others errors too.
|
||||
if int(value) <= 0:
|
||||
value = 86400
|
||||
# Also limit to max 32-bit integer
|
||||
value = min(max(int(value), 86400), 2**31 - 1)
|
||||
value = datetime.fromtimestamp(int(value))
|
||||
return value
|
||||
|
||||
|
|
Loading…
Reference in a new issue