Michał Żygowski has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/80790?usp=email )
Change subject: lib/rtc: Fix off-by-one error in February day count in leap year ......................................................................
lib/rtc: Fix off-by-one error in February day count in leap year
The month argument passed to rtc_month_days is 0-based, not 1-based. This results in the RTC being reverted to the build date constantly on 29th February 2024.
Change-Id: If451e3e3471fef0d429e255cf297050a525ca1a2 Signed-off-by: Michał Żygowski michal.zygowski@3mdeb.com --- M src/lib/rtc.c 1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/90/80790/1
diff --git a/src/lib/rtc.c b/src/lib/rtc.c index d151480..3eeac27 100644 --- a/src/lib/rtc.c +++ b/src/lib/rtc.c @@ -126,7 +126,7 @@ { int month_days[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
- return month_days[month] + (LEAP_YEAR(year) && month == 2); + return month_days[month] + (LEAP_YEAR(year) && month == 1); }
int rtc_invalid(const struct rtc_time *tm)