Skip to content

Wrong Leap Year Calculation #125

Closed
@tim-scherer

Description

@tim-scherer

Subject of the issue

  • The leap year calculation yields that 2022 is a leap year; but next leap year is 2024.
  • As a result of this, epoch time calculation error is 86400 s (24 h) wrong.

Your workbench

SparkFun_u-blox_GNSS_Arduino_Library](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library Library V2.2.0

Steps to reproduce

The error is located in the calculation perfomed in

DAYS_SINCE_MONTH[((uint32_t)packetUBXNAVPVT->data.year - 1970) & 3][(uint32_t)packetUBXNAVPVT->data.month] +

and

Expected behavior

2022 is not a leap year

Actual behavior

DAYS_SINCE_MONTH[((uint32_t)packetUBXNAVPVT->data.year - 1970) & 3][(uint32_t)packetUBXNAVPVT->data.month] results as a leap year

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions