Skip to content

GPSTimestamp getTime() is Off by One Month #5

Open

Description

@J0hannB

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.

Activity

  1. changed the title [-]GPSTimestamp getTime() is Off by one month[/-] [+]GPSTimestamp getTime() is Off by One Month[/+] on Aug 7, 2018
  2. hicklin commented on Aug 31, 2018

    @hicklin

    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;.

  3. sikbrad commented on May 31, 2021

    @sikbrad

    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.

  4. added a commit that references this issue on May 31, 2021
    a33323f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions