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;
|
hour = time / 10000;
|
||||||
minute = (time % 10000) / 100;
|
minute = (time % 10000) / 100;
|
||||||
seconds = (time % 100);
|
seconds = (time % 100);
|
||||||
p = strchr(p, '.');
|
char *dec = strchr(p, '.');
|
||||||
milliseconds = atof(p) * 1000;
|
char *comstar = min(strchr(p, ','), strchr(p, '*'));
|
||||||
|
if(dec != NULL && comstar != NULL && dec < comstar)
|
||||||
|
milliseconds = atof(p) * 1000;
|
||||||
|
else milliseconds = 0;
|
||||||
lastTime = sentTime;
|
lastTime = sentTime;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue