From 44138ba4631c64c4a2cad9ffc140130a961fd87f Mon Sep 17 00:00:00 2001 From: xenDE Date: Sun, 15 Dec 2019 23:37:48 +0100 Subject: [PATCH] webgpsmap: fix parsing new timezone format "Z" in gps data fix timezone "Z": "2019-11-28T04:44:46.79231Z" >> "2019-11-28T04:44:46.79231+00:00" issue: https://github.com/evilsocket/pwnagotchi/issues/708 --- pwnagotchi/plugins/default/webgpsmap.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pwnagotchi/plugins/default/webgpsmap.py b/pwnagotchi/plugins/default/webgpsmap.py index 85479f9b..3d7ae4df 100644 --- a/pwnagotchi/plugins/default/webgpsmap.py +++ b/pwnagotchi/plugins/default/webgpsmap.py @@ -304,6 +304,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'] + #fix timezone "Z": "2019-11-28T04:44:46.79231Z" >> "2019-11-28T04:44:46.79231+00:00" + if date_iso_formated.endswith("Z"): + date_iso_formated = date_iso_formated[:-1] + "+00:00" # bad microseconds fix: fill/cut microseconds to 6 numbers part1, part2, part3 = re.split('\.|\+', date_iso_formated) part2 = part2.ljust(6, '0')[:6]