More rigor in parseTime()

previous version ran ok with M0, but generated exceptions in ESP32 when decimals not found.
This commit is contained in:
Rick Sellens 2020-02-07 14:26:39 -05:00
parent 07fd81fd91
commit a047465a73
1 changed files with 5 additions and 2 deletions

View File

@ -768,8 +768,11 @@ bool Adafruit_GPS::parseTime(char *p) {
hour = time / 10000;
minute = (time % 10000) / 100;
seconds = (time % 100);
p = strchr(p, '.');
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;
}