diff options
author | Jakub Czapiga <jacz@semihalf.com> | 2021-04-15 12:30:27 +0200 |
---|---|---|
committer | Paul Fagerburg <pfagerburg@chromium.org> | 2021-04-19 13:04:58 +0000 |
commit | 48b00790009d9e1a6b664312de1e13b0732fc9fe (patch) | |
tree | e5026c2239920aecc982ac2ebb3e307f5f12fffd /src | |
parent | ac9af1adb97131ddd2cb1626020d80f0bd8a16fc (diff) |
lib/rtc: Fix incomplete leap year macro
Signed-off-by: Jakub Czapiga <jacz@semihalf.com>
Found-by: Paul Fagerburg <pfagerburg@chromium.org>
Change-Id: Ic434c969141c67ce317a5db0c8805de02c84eb08
Reviewed-on: https://review.coreboot.org/c/coreboot/+/52370
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
Diffstat (limited to 'src')
-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 5e03cfae1e..c5fffa0e8b 100644 --- a/src/lib/rtc.c +++ b/src/lib/rtc.c @@ -11,7 +11,7 @@ #define STARTOFTIME 1970 #define SECDAY 86400L #define SECYR (SECDAY * 365) -#define LEAP_YEAR(year) ((year) % 4 == 0) +#define LEAP_YEAR(year) (((year) % 4 == 0 && (year) % 100 != 0) || (year) % 400 == 0) #define DAYS_IN_YEAR(a) (LEAP_YEAR(a) ? 366 : 365) #define DAYS_IN_MONTH(a) (month_days[(a) - 1]) |