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=-2.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, 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 695DF222FE for ; Mon, 25 Mar 2024 01:37:18 +0100 (CET) Received: (qmail 29929 invoked by uid 550); 25 Mar 2024 00:32:35 -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 29895 invoked from network); 25 Mar 2024 00:32:34 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1711327026; x=1711586226; bh=srEvcElhNSl5IDcrzohVOCD3i9HdXE6ZhQYkf2R1wWs=; h=Date:To:From:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=eRDKiCCiwAisW+D+MxfzyMMb/SBb65tfdpnQ/u5U+KlFEt2Zn4m3j5l9754s4/NtU Cf1c7TplgC3NuEidhCp3hxqp7C2oppIZRCFBR1Npf9jVRzhzb5lckmKtgd9TE6Vi1z G9//aDpXZdy3eRzZqNBKwCCP2buYfew8a28Uonc/fkAbO13+SEwXF5xe4xl9jfWVXC bxXNq8zxf/lltyy5iiv3y5npzdb+XyDol79sMAgG52zM+EgQIOzfEEnHNEiyVSmez2 lI6IAARkw40I2DiCH7d2ndvdriLZSiTCB5+zwF/SPoK63ufzzROQNiIwefuZLiScEL SsZekwqiOcAFQ== Date: Mon, 25 Mar 2024 00:36:49 +0000 To: musl@lists.openwall.com From: Alexander Weps Message-ID: <4YlR0YRqzZlDIOVv6SP8UDoop89n8u7BvQl_7eXNTvDZnogXMxG1z-TLGIBf-O4edUphddXGfADbk_d7Uzb37g5JoH7vOIvvNRMFDxPWZok=@pm.me> In-Reply-To: References: <20240324170436.GV4163@brightrain.aerifal.cx> <0_9-JV2MW3avVvzhE9vjqKqCX0fEZy0uUuZKIohFGEFDBY912nwZyxZe560H0cf_b8L2gD8e0eUAUp2Q3e1rmra3XEppx9HPhhFeulwLYZA=@pm.me> <20240324180200.GW4163@brightrain.aerifal.cx> <20240324182458.GX4163@brightrain.aerifal.cx> <9c2qfe36CoPBfKjzn1lDDZ_hfyNJCZW6-6ZTZlQgHAPr2djicIMMweEqUoQoQsDWsBt4AAZBL8vZlcsVCL950rYhcPpMDvhzDWean3oVHbs=@pm.me> <20240324192258.GY4163@brightrain.aerifal.cx> <-svm5EdX4OFN9hKzgS2FP6N1lgUGjT7edQONkAfCywgsRitwT6Vw22W3sUUGY_pnKGIXBKlujMZhPCDkJAMCYbBA5uF-IYgzhj8WB0wBE-A=@pm.me> Feedback-ID: 20507743:user:proton 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 I have no problem with the POSIX (Issue 8) or ISO C standard. I agree it doesn't mandate mktime making correct calculations, but I would = assume it is expected. AW On Monday, March 25th, 2024 at 00:51, Thorsten Glaser wrote: > Alexander Weps dixit: > > > You are describing the musl behavior, more specifically what I see in m= ktime & __tm_to_secs. > > I don't think this is correct behavior. > > > This is what POSIX (Issue 8) and AFAIR also the next ISO C standard > mandate, though: > > 1.=E2=80=936. struct tm is normalised from seconds or minutes up to year > 7. struct tm is converted to time_t (wrongly written down as > =E2=80=9Cthe number of seconds since the epoch=E2=80=9D as it omits leap > seconds) > 8. timezone corrections for standard time at the moment in > time calculated in step 7 is applied > 9. if the timezone has DST: > + if tm_isdst is positive, the time is adjusted by the offset > + if tm_isdst is negative, the result is either the same as > if it were 0 or the same as if it were 1; if the struct tm > specifies a gap or repeated segment, which of the two is > used is explicitly unspecified, i.e. the caller cannot rely > on the libc to guess his intent if he sets tm_isdst to -1. > 10. (not numbered) for gaps or repeats, mktime uses either the value > from before the gap/repeat or the one after, choice again > unspecified > > Tough luck there. > > The wording in this part is interesting though: > > | If tm_isdst is positive, mktime() shall further adjust the seconds > | since the Epoch by the DST offset. > > But I guess that if you call with tm_isdst=3D1 and a broken-down time > that clearly corresponds to n=C5=8Dn-DST, the DST offset for it is just 0 > and it=E2=80=99ll work out the obvious way. > > bye, > //mirabilos > -- > =E2=80=9CIt is inappropriate to require that a time represented as > seconds since the Epoch precisely represent the number of > seconds between the referenced time and the Epoch.=E2=80=9D > -- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2