diff options
author | Michał Żygowski <michal.zygowski@3mdeb.com> | 2024-02-29 11:50:58 +0100 |
---|---|---|
committer | Martin L Roth <gaumless@gmail.com> | 2024-02-29 18:39:25 +0000 |
commit | 0a280ff747b44d7a2a62206ea0c25dbcbc5ce20b (patch) | |
tree | 0492fa29fb4133834bcd51096ef0b4683eb595f5 | |
parent | 4845b69db29107ce8d9cd2969b4aad5c7daa6399 (diff) | |
download | coreboot-0a280ff747b44d7a2a62206ea0c25dbcbc5ce20b.tar.gz coreboot-0a280ff747b44d7a2a62206ea0c25dbcbc5ce20b.tar.bz2 coreboot-0a280ff747b44d7a2a62206ea0c25dbcbc5ce20b.zip |
lib/rtc: Fix off-by-one error in February day count in leap year24.02.01
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>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80790
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-by: Michał Kopeć <michal.kopec@3mdeb.com>
(cherry picked from commit adf042f6c61e92c181171118768e4309d87146b1)
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80823
-rw-r--r-- | src/lib/rtc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/rtc.c b/src/lib/rtc.c index d15148024d89..3eeac27665b5 100644 --- a/src/lib/rtc.c +++ b/src/lib/rtc.c @@ -126,7 +126,7 @@ static int rtc_month_days(unsigned int month, unsigned int year) { 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) |