From: Nick Porter Date: Wed, 13 Apr 2022 11:18:33 +0000 (+0100) Subject: Correct check for count of Februaries - tm_mon is 0 to 11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=53d8b2e5a8937193e58b897823fe4e8108dfbdf6;p=thirdparty%2Ffreeradius-server.git Correct check for count of Februaries - tm_mon is 0 to 11 --- diff --git a/src/lib/util/time.c b/src/lib/util/time.c index 8c438e82f41..34715787d8e 100644 --- a/src/lib/util/time.c +++ b/src/lib/util/time.c @@ -656,7 +656,7 @@ fr_unix_time_t fr_unix_time_from_tm(struct tm *tm) if (unlikely(tm->tm_year > 10000)) return fr_unix_time_min(); year_adj = tm->tm_year + 4800 + 1900; /* Ensure positive year, multiple of 400. */ - febs = year_adj - (tm->tm_mon <= 2 ? 1 : 0); /* Februaries since base. */ + febs = year_adj - (tm->tm_mon < 2 ? 1 : 0); /* Februaries since base. tm_mon is 0 - 11 */ leap_days = 1 + (febs / 4) - (febs / 100) + (febs / 400); days = 365 * year_adj + leap_days + month_yday[tm->tm_mon] + tm->tm_mday - 1;