From 1796a25e537ec5f144c1eba9920c6c287d400b6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Recht=C3=A9?= Date: Thu, 27 Oct 2016 07:10:36 -0600 Subject: [PATCH] Correct a problem in clock_gettime(CLOCK_REALTIME, &time); which is ahead by 1 month of the specified CONFIG_START_MONTH --- libc/time/lib_daysbeforemonth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/time/lib_daysbeforemonth.c b/libc/time/lib_daysbeforemonth.c index 8c09c2203e8..8c66dc808b6 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]; - if (month >= 2 && leapyear) + int retval = g_daysbeforemonth[month-1]; + if (month > 2 && leapyear) { retval++; }