NemaTode icon indicating copy to clipboard operation
NemaTode copied to clipboard

GPSTimestamp getTime() is Off by One Month

Open J0hannB opened this issue 6 years ago • 2 comments

The month of year field in $GPRMC sentences is indexed 1-12. This is also how it it is stored in the month class member of GPSTimestamp. In getTime(), however mktime() is called, which expects months be 0-11.

This results in the timestamp returned by getTime being off by one month.

J0hannB avatar Aug 06 '18 20:08 J0hannB

I have fixed this in my local copy by changing line 170 in src/GPSFix.cpp from t.tm_mon = month; to t.tm_mon = month - 1;.

hicklin avatar Aug 31 '18 08:08 hicklin

I found this too! Thank you @hicklin But your build has error and cannot build without edition. 'timezone' identifier in 'getTime' func comes out of nowhere. Maybe you have missing commit or something.

sikbrad avatar May 31 '21 15:05 sikbrad