NemaTode icon indicating copy to clipboard operation
NemaTode copied to clipboard

GPSTimestamp::getTime() has time shift in the opposite direction of the system time wrt UTC

Open hicklin opened this issue 6 years ago • 1 comments

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.

hicklin avatar Oct 09 '18 10:10 hicklin

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;

hicklin avatar Oct 09 '18 10:10 hicklin