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=-0.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 DFD7B20551 for ; Wed, 27 Mar 2024 02:42:24 +0100 (CET) Received: (qmail 26599 invoked by uid 550); 27 Mar 2024 01:37:34 -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 26561 invoked from network); 27 Mar 2024 01:37:33 -0000 Date: Wed, 27 Mar 2024 01:35:47 +0000 (UTC) From: Thorsten Glaser X-X-Sender: tg@herc.mirbsd.org To: musl@lists.openwall.com In-Reply-To: Message-ID: References: <20240325122113.GB4163@brightrain.aerifal.cx> Content-Language: de-Zsym-DE-1901-u-em-text-rg-denw-tz-utc, en-Zsym-GB-u-cu-eur-em-text-fw-mon-hc-h23-ms-metric-mu-celsius-rg-denw-tz-utc-va-posix MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Subject: Re: [musl] Broken mktime calculations when crossing DST boundary Alexander Weps dixit: >But mktime can return -1 if and when it deems that struct tm cannot be >represented in epoch seconds. But it CAN be represented in epoch seconds. It can only not be represented in epoch seconds if it=E2=80=99s outside of the range of time_t, e.g. [LONG_MIN; LONG_MAX]. POSIX even explicitly documents how these discontinuities are mapped, which I already quoted: | If a geographical timezone changes its UTC offset such that =E2=80=9Cold | 00:00=E2=80=9D becomes =E2=80=9Cnew 00:30=E2=80=9D and mktime() is given = 00:20, it treats that | as either 20 minutes after =E2=80=9Cold 00:00=E2=80=9D or 10 minutes befo= re =E2=80=9Cnew | 00:30=E2=80=9D, and gives back appropriately altered struct tm fields. This makes it clear that there are two ways the struct tm can be represented in time_t, and that the implementation must choose one of them. bye, //mirabilos --=20 [...] if maybe ext3fs wasn't a better pick, or jfs, or maybe reiserfs, oh b= ut what about xfs, and if only i had waited until reiser4 was ready... in the = be- ginning, there was ffs, and in the middle, there was ffs, and at the end, t= here was still ffs, and the sys admins knew it was good. :) -- Ted Unangst =C3= =BCber *fs