From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 20967 invoked from network); 28 Feb 2021 15:09:36 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 28 Feb 2021 15:09:36 -0000 Received: (qmail 20074 invoked by uid 550); 28 Feb 2021 15:09:33 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 20043 invoked from network); 28 Feb 2021 15:09:33 -0000 X-Virus-Scanned: by amavisd-new at kth.se X-KTH-Auth: maandree [2001:1ba8:120c:d700:5e2a:93e6:8546:53b5] DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kth.se; s=default; t=1614524961; bh=dA3LkfUKd/C659Z9vCwNfXR6KAIqwsztlNiykpdiUIE=; h=From:To:Cc:Subject:Date; b=ORGQDJVri+amAnavw6KX+z9T4Sp+jc3DtIYiKcFz2NvGLeH3c2Z7NGtdIJcIf4qXU HC4xJVgYzaAojhssP1QdWANIjvPeX2QGVSHiQLvCwKoSTjFpbeM1eK7Rq5xDtdoxAv 4HgvpiiezqTINmfdNyTOpICnQd2jeLPYG0U8sftU= X-KTH-mail-from: maandree@kth.se From: =?UTF-8?q?Mattias=20Andr=C3=A9e?= To: musl@lists.openwall.com Cc: =?UTF-8?q?Mattias=20Andr=C3=A9e?= Date: Sun, 28 Feb 2021 16:09:12 +0100 Message-Id: <20210228150912.1532943-1-maandree@kth.se> X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [musl] [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