-
Notifications
You must be signed in to change notification settings - Fork 7.4k
drivers: rtc: mc146818: fix y2k bug #59402
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
Conversation
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]>
One additional modification
|
I haven't yet tested rolling over from 1999 to 2000 - should we?? What if something terrible were to happen?? 😬 |
Nice work! If you want to test rolling over from 1999 to 2000, change this define to |
Let me add a y2k testcase. Any others we should add currently? 2038? |
We can add 1999 to 2000 to the test suite, but that should probably go into its own its own PR :) 2038 is not relevant since RTCs don't track time using integers, that would have to be part of some counter test suite to be relevant i think :) |
It's practically done already - I might as well add it here. Plus The Zephyr Way is to add tests along with bugfixes, when possible.
True, yea. |
Hmm... should have put a DNM on this - driver also fails to pass testsuite when |
That's correct. We are still fixing the Y2K bug in 2023 \o/
Aside from that, there were a few other errors in the driver.
rtc_mc146818_validate_time()
rtc_mc146818_validate_alarm()
With the above, the testsuite passes!
Fixes #59387