On 32bit platforms, time_t is still a signed 32bit long. If it is
overflowed, userspace and the kernel cant agree on the current system time.
This causes multiple issues, in particular with systemd:
https://github.com/systemd/systemd/issues/1143
A good workaround is to simply avoid using systohc which is something I
greatly encourage as the time is better set by userspace.
However, many distribution enable it and use systemd which is rendering the
system unusable in case the RTC holds a date after 2038 (and more so after
2106). Many drivers have workaround for this case and they should be
eliminated so there is only one place left to fix when userspace is able to
cope with dates after the 31bit overflow.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/hctosys.c | 5 +++++
1 file changed, 5 insertions(+)
Dates after 2038 actually fit on 32 bits. The counter will overflow in
2106. Also, it is bad practice to reset the RTC to a default value.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-mv.c | 12 ------------
1 file changed, 12 deletions(-)
The hardware supports years up to 100 so don't limit the year to 2038
artificially.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-mrst.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
The 88pm80x supports time up to 2106 (it is a 32 bit counter). Also, the
year will never be before 1970 as the RTC core forbids that.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-88pm80x.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
@@ -134,9 +134,9 @@ static int pm80x_rtc_set_time(struct device *dev, struct rtc_time *tm)structpm80x_rtc_info*info=dev_get_drvdata(dev);unsignedcharbuf[4];unsignedlongticks,base,data;-if((tm->tm_year<70)||(tm->tm_year>138)){+if(tm->tm_year>206){dev_dbg(info->dev,-"Set time %d out of range. Please set time between 1970 to 2038.\n",+"Set time %d out of range. Please set time between 1970 to 2106.\n",1900+tm->tm_year);return-EINVAL;}
The 88pm860x supports time up to 2106 (it is a 32 bit counter). Also, the
year will never be before 1970 as the RTC core forbids that.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-88pm860x.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
@@ -135,9 +135,9 @@ static int pm860x_rtc_set_time(struct device *dev, struct rtc_time *tm)unsignedcharbuf[4];unsignedlongticks,base,data;-if((tm->tm_year<70)||(tm->tm_year>138)){+if(tm->tm_year>206){dev_dbg(info->dev,"Set time %d out of range. "-"Please set time between 1970 to 2038.\n",+"Please set time between 1970 to 2106.\n",1900+tm->tm_year);return-EINVAL;}