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; }