NemaTode
NemaTode copied to clipboard
GPSTimestamp::getTime() has time shift in the opposite direction of the system time wrt UTC
The mktime function used to convert the tm struct to time_t (seconds since Jan 1, 1970) assumes that the tm struct time is in local time. Hence, in the instance that the system time is not equal to UTC, the GPS time returned is shifted by the timezone in the opposite direction.
I have fixed the issue in my fork by subtracting the timezone in seconds from the returned time_t in line 175 of GPSFix.cpp.
return mktime(&t) - timezone;