Skip to content

RTC 12h to 24h mode conversion is wrong for noon and midnight #72

Description

@dillof

The conversion in getrtc simply adds 12 if PM is set.

However, in 12h mode, midnight is represented as hour=12 pm=0, which is converted to 24h mode as 12.

Likewise, noon is represented as hour=12, pm=1, which is converted to 24.

So, a special case is needed if hour==12: Set hour to 0 if pm==0, otherwise leave unchanged.

setrtc has the same problem in reverse.

Activity

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

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions