From 57ad019fba24e2040ff6760cff9a0efedecf3236 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 27 Oct 2016 08:20:16 -0600 Subject: [PATCH] Revert "Correct a problem in clock_gettime(CLOCK_REALTIME, &time); which is ahead by 1 month of the specified CONFIG_START_MONTH" I don't believe this change is correct in general. Nomralling clock_isleapyear() is called with tm_mon which is in the range of 0-11. That change would be bad for that range. It would make sense for a range of 1-12, but that is not how tm_mon is defined. This reverts commit 1796a25e537ec5f144c1eba9920c6c287d400b6e. --- 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 8c66dc808b6..8c09c2203e8 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++; }