From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: from second.openwall.net (second.openwall.net [193.110.157.125]) by inbox.vuxu.org (Postfix) with SMTP id 871E622285 for ; Sun, 12 May 2024 09:54:27 +0200 (CEST) Received: (qmail 1663 invoked by uid 550); 12 May 2024 07:54:24 -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 1628 invoked from network); 12 May 2024 07:54:23 -0000 Date: Sun, 12 May 2024 09:54:13 +0200 From: Petr Pisar To: musl@lists.openwall.com Message-ID: Mail-Followup-To: musl@lists.openwall.com References: <20240511212853.GS10433@brightrain.aerifal.cx> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="lZG4MKD11tu/S7Ie" Content-Disposition: inline In-Reply-To: <20240511212853.GS10433@brightrain.aerifal.cx> Subject: Re: [musl] strptime(s, "%Y-%j", &tm) does not update month and day --lZG4MKD11tu/S7Ie Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable V=C2=A0Sat, May 11, 2024 at 05:28:54PM -0400,=C2=A0Rich Felker napsal(a): > On Sat, May 11, 2024 at 05:24:59PM +0200, Petr Pisar wrote: > > Hello, > >=20 > > When debugging a libisds test failure with musl-1.2.5 > > , I found that musl's > > strptime() does not handle "%Y-%j" properly. It accepts the format, it = parses > > the input string, it returns a correct pointer past the input string, b= ut it > > does not update tm.tm_mon and tm.tm_mday fileds of the third argument. >=20 > This is behaving as specified. Previously, the behavior was > unspecified. POSIX has amended it for future issues as the resolution > of https://austingroupbugs.net/view.php?id=3D1727 to read: >=20 > The tm_yday member of the tm structure pointed to by tm shall be > set to this number minus 1. >=20 > strptime generally does not behave like mktime, doing > normalizations/conversions. >=20 I see. I thought that strptime() does the normalization. Reading mktime() specification reveals it has a side effect of normalizing tm_yday =66rom tm_year, tm_mon, and tm_mday. However, I need the oposite and I cannot find any standard library function for that. I will probaly resort to my own implementation with the drawback of assumption that rules for leap years in Gregorian calendar won't change. -- Petr --lZG4MKD11tu/S7Ie Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE4/QvzhVoMKgDWObpT9GuwzZa978FAmZAdZcACgkQT9GuwzZa 97+YnhAAuzzFfZr7B3g/wQC4MKBe+LYrtgQbvp/9vNH4mDlQ/ohK/xuZbjuVq9ky ykPahYaJxFypvv1Hix7DuDR/8iywqfhFJ9vEGOrYaSAZA/oDxG1xSmuwKD7P7UEb bwZnJl0EnD5XyHPCMPJrKg4qAGpwRAO7YmUr7looPPqeLjt79WJaeYmTQtusreKf X/tFLZ60U8+0LUAdynN0dI7x4ACaUG5mP2ieQg5ZL8bq74bkQOG1QlHnXbYP8TQ7 ryXc4H/vgLuajjDw9C32eLrcx0fTSpv+O5cajShofV+jA8YMoM0YZingKOsPICc5 C4y91x842iAf5IkoguHly49/OPI5fEpbeesCfVQNP/S+yMEyULqP5seDO2ilTyh/ AfTLRV8JPvpyYypmH/iBjmsuqsn93HeIMvKNaQLDiOOAurW4WcueyB1Pujpl0McV 5VJExa5DH+tZyuIaWJLuDyJN9oULSrEdAYDdtQnaXq1OScfjSLWX7G9hPRe5oih/ VYpeVuviA1zQQzQvdywYC+1tOD1gyLoqOqp/DulP2tHkcqnQuo1WtA9M/a4P3YVN kP+Dp3WxNX3/7DH3T+kidspuFtZFC/h37lBFKP99MWCpRs17XsVjj4SWgxLIqLJ5 m+MYNgc1cyhKs2ER8PDExm0sTLo5e5wQSvyrhje2CXfEAN6ezes= =0E0q -----END PGP SIGNATURE----- --lZG4MKD11tu/S7Ie--