Fix error when GPS send None timestamp
This commit is contained in:
parent
7146111a56
commit
e84682c391
@ -362,13 +362,10 @@ class GPSData(Data):
|
||||
|
||||
if self._enable:
|
||||
self._gps_current_fix = int(time.monotonic())
|
||||
self.data['time'] = TIME_FORMAT.format(
|
||||
self._gps.timestamp_utc.tm_year,
|
||||
self._gps.timestamp_utc.tm_mon,
|
||||
self._gps.timestamp_utc.tm_mday,
|
||||
self._gps.timestamp_utc.tm_hour,
|
||||
self._gps.timestamp_utc.tm_min,
|
||||
self._gps.timestamp_utc.tm_sec)
|
||||
if self._gps.timestamp_utc is not None:
|
||||
self.data['time'] = TIME_FORMAT.format(*self._gps.timestamp_utc[0:6])
|
||||
else:
|
||||
self.data['time'] = TIME_FORMAT.format(2018, 9, 10, 10, 0, 0)
|
||||
if self._gps.has_fix:
|
||||
self._gps_last_fix = self._gps_current_fix
|
||||
self.data['lat'] = self._gps.latitude
|
||||
|
Loading…
Reference in New Issue
Block a user