More rigor in parseTime()
previous version ran ok with M0, but generated exceptions in ESP32 when decimals not found.
This commit is contained in:
parent
07fd81fd91
commit
a047465a73
|
|
@ -768,8 +768,11 @@ bool Adafruit_GPS::parseTime(char *p) {
|
|||
hour = time / 10000;
|
||||
minute = (time % 10000) / 100;
|
||||
seconds = (time % 100);
|
||||
p = strchr(p, '.');
|
||||
milliseconds = atof(p) * 1000;
|
||||
char *dec = strchr(p, '.');
|
||||
char *comstar = min(strchr(p, ','), strchr(p, '*'));
|
||||
if(dec != NULL && comstar != NULL && dec < comstar)
|
||||
milliseconds = atof(p) * 1000;
|
||||
else milliseconds = 0;
|
||||
lastTime = sentTime;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue