Skip to content

Commit db91900

Browse files
committed
Fix _set_timestamp return value bug.
1 parent 8b67270 commit db91900

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

gps/as_GPS.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,14 @@ def _fix(self, gps_segments, idx_lat, idx_long):
231231
# Set timestamp. If time/date not present retain last reading (if any).
232232
def _set_timestamp(self, utc_string):
233233
if utc_string: # Possible timestamp found
234-
self.timestamp[0] = int(utc_string[0:2]) + self.local_offset # h
235-
self.timestamp[1] = int(utc_string[2:4]) # mins
236-
self.timestamp[2] = int(utc_string[4:]) # secs
234+
try:
235+
self.timestamp[0] = int(utc_string[0:2]) + self.local_offset # h
236+
self.timestamp[1] = int(utc_string[2:4]) # mins
237+
self.timestamp[2] = int(utc_string[4:]) # secs
238+
return True
239+
except ValueError:
240+
pass
241+
return False
237242

238243
########################################
239244
# Sentence Parsers

0 commit comments

Comments
 (0)