diff --git a/libc/time/lib_daysbeforemonth.c b/libc/time/lib_daysbeforemonth.c index 8c66dc808b..8c09c2203e 100644 --- a/libc/time/lib_daysbeforemonth.c +++ b/libc/time/lib_daysbeforemonth.c @@ -91,8 +91,8 @@ static const uint16_t g_daysbeforemonth[13] = int clock_daysbeforemonth(int month, bool leapyear) { - int retval = g_daysbeforemonth[month-1]; - if (month > 2 && leapyear) + int retval = g_daysbeforemonth[month]; + if (month >= 2 && leapyear) { retval++; }