Messages in this thread | | | Date | Thu, 10 Dec 2015 10:57:24 -0800 | Subject | Re: [PATCH v2] RTC: RK808: Work around hardware bug on November 31st | From | Julius Werner <> |
| |
> I'll try to review and evaluate both solution by the end of the week (no > guarantee though).
To summarize, it's a pretty simple trade-off. Do you:
a) try to detect every time the RTC deviated from the real-world time and correct it instantly? This can be done most of the time but there are edge cases (when the system is completely powered off while the RTC ticks over Nov 31st) where you cannot detect it. Or,
b) just completely let the RTC tick in its own world where every year has an extra day and convert that "calendar" to/from the real-world calendar on every access. This essentially relegates the RTC to a "dumb second counter" and the timestamp in its registers doesn't have any direct connection to the real world time anymore (unless you know the conversion algorithm). This has the nice advantage that it perfectly solves all use cases (time-keeping, accurate alarms, even when shut down or browning out at inopportune times)... the only real disadvantage is that other software (e.g. U-Boot) reading the same RTC must know about this and use the same conversion code to get the correct real-world time from it.
| |