50
50
51
51
_SENTENCE_PARAMS = (
52
52
# 0 - _GLL
53
- "dcdcfcC " ,
53
+ "dcdcscC " ,
54
54
# 1 - _RMC
55
- "fcdcdcffiDCC " ,
55
+ "scdcdcffsDCC " ,
56
56
# 2 - _GGA
57
- "fdcdciiffsfsIS " ,
57
+ "sdcdciiffsfsIS " ,
58
58
# 3 - _GSA
59
59
"ciIIIIIIIIIIIIfff" ,
60
60
# 4 - _GSA_4_11
68
68
# 8 - _GSV19
69
69
"iiiiiiIiiiIiiiIiiiI" ,
70
70
# 9 - _RMC_4_1
71
- "fcdcdcffiDCCC " ,
71
+ "scdcdcffsDCCC " ,
72
72
)
73
73
74
74
@@ -394,9 +394,9 @@ def _parse_sentence(self):
394
394
return (data_type , sentence [delimiter + 1 :])
395
395
396
396
def _update_timestamp_utc (self , time_utc , date = None ):
397
- hours = time_utc // 10000
398
- mins = (time_utc // 100 ) % 100
399
- secs = time_utc % 100
397
+ hours = int ( time_utc [ 0 : 2 ])
398
+ mins = int (time_utc [ 2 : 4 ])
399
+ secs = int ( time_utc [ 4 : 6 ])
400
400
if date is None :
401
401
if self .timestamp_utc is None :
402
402
day , month , year = 0 , 0 , 0
@@ -405,9 +405,9 @@ def _update_timestamp_utc(self, time_utc, date=None):
405
405
month = self .timestamp_utc .tm_mon
406
406
year = self .timestamp_utc .tm_year
407
407
else :
408
- day = date // 10000
409
- month = (date // 100 ) % 100
410
- year = 2000 + date % 100
408
+ day = int ( date [ 0 : 2 ])
409
+ month = int (date [ 2 : 4 ])
410
+ year = 2000 + int ( date [ 4 : 6 ])
411
411
412
412
self .timestamp_utc = time .struct_time (
413
413
(year , month , day , hours , mins , secs , 0 , 0 , - 1 )
@@ -429,7 +429,7 @@ def _parse_gll(self, data):
429
429
self .longitude = _read_degrees (data , 2 , "w" )
430
430
431
431
# UTC time of position
432
- self ._update_timestamp_utc (int ( data [4 ]) )
432
+ self ._update_timestamp_utc (data [4 ])
433
433
434
434
# Status Valid(A) or Invalid(V)
435
435
self .isactivedata = data [5 ]
@@ -450,7 +450,7 @@ def _parse_rmc(self, data):
450
450
return False # Params didn't parse
451
451
452
452
# UTC time of position and date
453
- self ._update_timestamp_utc (int ( data [0 ]) , data [8 ])
453
+ self ._update_timestamp_utc (data [0 ], data [8 ])
454
454
455
455
# Status Valid(A) or Invalid(V)
456
456
self .isactivedata = data [1 ]
@@ -494,7 +494,7 @@ def _parse_gga(self, data):
494
494
return False # Params didn't parse
495
495
496
496
# UTC time of position
497
- self ._update_timestamp_utc (int ( data [0 ]) )
497
+ self ._update_timestamp_utc (data [0 ])
498
498
499
499
# Latitude
500
500
self .latitude = _read_degrees (data , 1 , "s" )
0 commit comments