Fix error when GPS send None timestamp

This commit is contained in:
Pierrick C 2018-09-10 11:02:38 +02:00
parent 7146111a56
commit e84682c391

View File

@ -362,13 +362,10 @@ class GPSData(Data):
if self._enable: if self._enable:
self._gps_current_fix = int(time.monotonic()) self._gps_current_fix = int(time.monotonic())
self.data['time'] = TIME_FORMAT.format( if self._gps.timestamp_utc is not None:
self._gps.timestamp_utc.tm_year, self.data['time'] = TIME_FORMAT.format(*self._gps.timestamp_utc[0:6])
self._gps.timestamp_utc.tm_mon, else:
self._gps.timestamp_utc.tm_mday, self.data['time'] = TIME_FORMAT.format(2018, 9, 10, 10, 0, 0)
self._gps.timestamp_utc.tm_hour,
self._gps.timestamp_utc.tm_min,
self._gps.timestamp_utc.tm_sec)
if self._gps.has_fix: if self._gps.has_fix:
self._gps_last_fix = self._gps_current_fix self._gps_last_fix = self._gps_current_fix
self.data['lat'] = self._gps.latitude self.data['lat'] = self._gps.latitude