Skip to content

Commit ff164ae

Browse files
Riwen Lualexandrebelloni
authored andcommitted
rtc: cmos: Evaluate century appropriate
There's limiting the year to 2069. When setting the rtc year to 2070, reading it returns 1970. Evaluate century starting from 19 to count the correct year. $ sudo date -s 20700106 Mon 06 Jan 2070 12:00:00 AM CST $ sudo hwclock -w $ sudo hwclock -r 1970-01-06 12:00:49.604968+08:00 Fixes: 2a4daad ("rtc: cmos: ignore bogus century byte") Signed-off-by: Riwen Lu <[email protected]> Acked-by: Eric Wong <[email protected]> Reviewed-by: Mateusz Jończyk <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 900ed72 commit ff164ae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/rtc/rtc-mc146818-lib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ int mc146818_get_time(struct rtc_time *time)
159159
#endif
160160

161161
#ifdef CONFIG_ACPI
162-
if (p.century > 20)
162+
if (p.century > 19)
163163
time->tm_year += (p.century - 19) * 100;
164164
#endif
165165

0 commit comments

Comments
 (0)