|
Message-Id: <20210228150912.1532943-1-maandree@kth.se> Date: Sun, 28 Feb 2021 16:09:12 +0100 From: Mattias Andrée <maandree@....se> To: musl@...ts.openwall.com Cc: Mattias Andrée <maandree@....se> Subject: [PATCH] Remove unnecessary if in __secs_to_tm Since years divisible by 100 but not by 400 are not leap years, q_cycles can at most be 24 (DAYS_PER_100Y / DAYS_PER_4Y == 24). --- src/time/__secs_to_tm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/time/__secs_to_tm.c b/src/time/__secs_to_tm.c index 093d9021..2d0c0b2c 100644 --- a/src/time/__secs_to_tm.c +++ b/src/time/__secs_to_tm.c @@ -44,8 +44,7 @@ int __secs_to_tm(long long t, struct tm *tm) remdays -= c_cycles * DAYS_PER_100Y; q_cycles = remdays / DAYS_PER_4Y; - if (q_cycles == 25) q_cycles--; - remdays -= q_cycles * DAYS_PER_4Y; + remdays %= DAYS_PER_4Y; remyears = remdays / 365; if (remyears == 4) remyears--; -- 2.30.1
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.