Merge pull request from xenDE/patch-1

fix gps iso-datetime parsing
This commit is contained in:
evilsocket 2019-11-19 11:30:15 +01:00 committed by GitHub
commit 0fb81a11c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -293,9 +293,9 @@ class PositionFile:
elif 'Updated' in self._json:
# convert gps datetime to unix timestamp: "2019-10-05T23:12:40.422996+01:00"
date_iso_formated = self._json['Updated']
# fill milliseconds to 6 numbers
# fill/cut microseconds to 6 numbers
part1, part2, part3 = re.split('\.|\+', date_iso_formated)
part2 = part2.ljust(6, '0')
part2 = part2.ljust(6, '0')[:6]
date_iso_formated = part1 + "." + part2 + "+" + part3
dateObj = datetime.datetime.fromisoformat(date_iso_formated)
return_ts = int("%.0f" % dateObj.timestamp())