Linux 4.17 Change To Allow RTCs To Live Beyond Their Intended Life
There still is the Year 2038 problem being dealt with across different parts of the Linux kernel as the most pressing and time sensitive Linux "Y2K"-like problem currently being tackled, but real-time clocks are also going to rollover at some point, assuming the hardware lasts that long. Kernel developers auditing the RTC drivers discovered that one RTC expired already in 2017, seven more drivers will expire before Year 2038, another 23 drivers will expire before Year 2069, 72 RTC drivers will expire by Year 2100, and 104 drivers will expire by Year 2106.
While some of these RTC drivers may not see their clocks turnover for close to a century, kernel developers have a solution in place that should be practical for those expiring sooner than that. With Linux 4.17 is an RTC offset API to be able to provide a defined offset to the RTC time, in order to extend the supported range of these real-time clocks. The RTC offset API allows for a time to be added when reading from hardware and subtracting when writing back. With that, the supported time-range can be shifted in the kernel for dealing with times past the intended RTC lifespan.
As part of this offset work is also an RTC range API for drivers to inform the Linux kernel core about supported time/date range.The RTC core code also now handles time_t overflows on 32-bit platforms rather than punting it off to the driver.
The Linux 4.17 RTC changes are outlined via this mailing list post.