Skip to content

Commit 559222c

Browse files
committed
Addressed issue with floor division still permitting floats through in the hour field.
1 parent dcf558b commit 559222c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

adafruit_gps.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,11 @@ def _parse_gpgga(self, args):
148148
if data is None or len(data) != 14:
149149
return # Unexpected number of params.
150150
# Parse fix time.
151-
time_utc = _parse_float(data[0])
151+
time_utc = int(_parse_float(data[0]))
152152
if time_utc is not None:
153153
hours = time_utc // 10000
154-
mins = int((time_utc // 100) % 100)
155-
secs = int(time_utc % 100)
154+
mins = (time_utc // 100) % 100
155+
secs = time_utc % 100
156156
# Set or update time to a friendly python time struct.
157157
if self.timestamp_utc is not None:
158158
self.timestamp_utc = time.struct_time((
@@ -184,11 +184,11 @@ def _parse_gprmc(self, args):
184184
if data is None or len(data) < 11:
185185
return # Unexpected number of params.
186186
# Parse fix time.
187-
time_utc = _parse_float(data[0])
187+
time_utc = int(_parse_float(data[0]))
188188
if time_utc is not None:
189189
hours = time_utc // 10000
190-
mins = int((time_utc // 100) % 100)
191-
secs = int(time_utc % 100)
190+
mins = (time_utc // 100) % 100
191+
secs = time_utc % 100
192192
# Set or update time to a friendly python time struct.
193193
if self.timestamp_utc is not None:
194194
self.timestamp_utc = time.struct_time((

0 commit comments

Comments
 (0)