From 7fcb437f293ece9b452be6c2279b987f8fd3b0d3 Mon Sep 17 00:00:00 2001 From: SarahW Date: Sat, 12 Jan 2019 16:49:44 +0000 Subject: [PATCH] Fixed index into RTC days_in_month tables. Patch from Tale. --- src/rtc.c | 2 +- src/rtc_tc8521.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rtc.c b/src/rtc.c index d1a0515..323e5a6 100644 --- a/src/rtc.c +++ b/src/rtc.c @@ -42,7 +42,7 @@ static int rtc_is_leap(int org_year) static int rtc_get_days(int org_month, int org_year) { if (org_month != 2) - return rtc_days_in_month[org_month]; + return rtc_days_in_month[org_month-1]; else return rtc_is_leap(org_year) ? 29 : 28; } diff --git a/src/rtc_tc8521.c b/src/rtc_tc8521.c index e5b8649..cfc1a36 100644 --- a/src/rtc_tc8521.c +++ b/src/rtc_tc8521.c @@ -37,7 +37,7 @@ static int rtc_is_leap(int org_year) static int rtc_get_days(int org_month, int org_year) { if (org_month != 2) - return rtc_days_in_month[org_month]; + return rtc_days_in_month[org_month-1]; else return rtc_is_leap(org_year) ? 29 : 28; }