Skip to content

Commit

Permalink
Merge pull request #629 from xenDE/patch-1
Browse files Browse the repository at this point in the history
fix gps iso-datetime parsing
  • Loading branch information
evilsocket authored Nov 19, 2019
2 parents b5a148f + 3351c25 commit 0fb81a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pwnagotchi/plugins/default/webgpsmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,9 @@ def timestamp_last(self):
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())
Expand Down

0 comments on commit 0fb81a1

Please sign in to comment.