Merge pull request #332 from pkkid/fix_276

fix datetime issue on windows.
This commit is contained in:
Hellowlol 2019-01-21 20:23:50 +01:00 committed by GitHub
commit b7914dd0d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -178,7 +178,9 @@ def toDatetime(value, format=None):
if format:
value = datetime.strptime(value, format)
else:
value = datetime.fromtimestamp(int(value))
# https://bugs.python.org/issue30684
# And platform support for before epoch seems to be flaky.
value = datetime.datetime(1970, 1, 1) + datetime.fromtimestamp(milliseconds=value)
return value