Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport v3.4-branch] drivers: rtc: mc146818: fix y2k bug #59644

Merged
merged 1 commit into from
Jul 25, 2023

Conversation

zephyrbot
Copy link
Collaborator

@zephyrbot zephyrbot commented Jun 22, 2023

Backport c8e0022 from #59402.

Fixes #59387

That's correct. We are still fixing the Y2K bug in 2023 \o/

* write century to RAM register 0x32
* ensure year register is in [0,99] (inclusive)

Aside from that, there were a few other errors in the driver.

* translate epoch-centric RTC API year to begin at 1900
* fix off-by-one error with month limit
* fix off-by-one error with wday
* fix off-by-one-hundred error with year limit
* adjust timeptr values in rtc_mc146818_validate_time()
* adjust timeptr values in rtc_mc146818_validate_alarm()

With the above, the testsuite passes!

Signed-off-by: Christopher Friedt <[email protected]>
(cherry picked from commit c8e0022)
@zephyrbot zephyrbot added Backport Backport PR and backport failure issues area: RTC Real Time Clock labels Jun 22, 2023
@jgl-meta jgl-meta merged commit 3f3051e into v3.4-branch Jul 25, 2023
1 check passed
@nashif nashif deleted the backport-59402-to-v3.4-branch branch August 15, 2023 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: RTC Real Time Clock Backport Backport PR and backport failure issues
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants