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 EFA9022718 for ; Sun, 24 Mar 2024 20:14:35 +0100 (CET) Received: (qmail 13816 invoked by uid 550); 24 Mar 2024 19:09:52 -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 13782 invoked from network); 24 Mar 2024 19:09:52 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1711307663; x=1711566863; bh=4cq3WahUHKcDWHEk20nirmZXmocHxHar0MwbKOt14lA=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=Gu5ZIhU2jHjk8wlcHDD1S/flINSwkQD1KRJNyysT7wuZ9JEFOyaPMakRVvKFSVR96 95IAvvTTpzj/THKy3+Tuh1KHu3/UsAo08NJKlCn3mQ8un8n00uh8uFU6pm2QkMqT29 uFYz/9i9kyBDcMKPWCHt/pHXguMfP+7OpSr4DrN5HdM1jBcAZW2KQuDwUzz/hyX2QS EC4VbjOCCidjEotYwA9BCOoMXjx+5RV3VP5uPNDrFGn7+dEj3XkSSwUw8beiY3I7oz i0mluklzSRWa+/S+HhB4ZVV7U+J5C7iESyKuyYB8K/ylxpJwHxRNWaqIFCNelxjz2P kr9tD6E+ChLWQ== Date: Sun, 24 Mar 2024 19:13:59 +0000 To: Rich Felker From: Alexander Weps Cc: musl@lists.openwall.com, Daniel Gutson , Markus Wichmann Message-ID: In-Reply-To: <3yixwTENdfygkyC-VpJQ3EN-X6RgOM_A9EYuLzX0CgM_wOfDncIPUkyoj7RQkfdPk_IvYOo6gNwao8cHNiWkNoZoa8DhvJk3i0fYp1mC1fU=@pm.me> 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> <3yixwTENdfygkyC-VpJQ3EN-X6RgOM_A9EYuLzX0CgM_wOfDncIPUkyoj7RQkfdPk_IvYOo6gNwao8cHNiWkNoZoa8DhvJk3i0fYp1mC1fU=@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 Sorry, found it, looked at wrong date in glibc: So Asia/Omsk: So glibc is: 1919-11-13 23:59:23 LMT 1919-11-14 00:06:52 +05 And musl is: 1919-11-13 23:59:32 LMT 1919-11-13 23:54:01 LMT AW On Sunday, March 24th, 2024 at 20:06, Alexander Weps wrot= e: > I ran Asia/Omsk from 1900 to 2200 there and back again (59 seconds increm= ents/decrements). > > Everything ok in glibc. > > Fails in musl very early: > 1919-11-13 23:59:32 LMT > 1919-11-13 23:54:01 LMT > > No idea what is even happening there. > > Glibc shows nothing interesting there: > 1911-12-13 23:59:32 LMT > 1911-12-14 00:00:31 LMT > > ??? > > AW > > > > On Sunday, March 24th, 2024 at 19:36, Alexander Weps exander77@pm.me wrot= e: > > > It is tiring, because you are not correct. > > > > You are also talking about a slightly different thing. > > > > If you have normalized time T1 in struct tm and you add something, norm= alize, you should always get normalized time T2, what is higher than T1. > > If you have normalized time T2 in struct tm and you subtract something,= normalize, you should always get normalized time T1, which is lower than T= 2. > > > > I agree than for non normalized time (tm_isdst =3D -1 etc.) this would = not apply. I agree that the decision how to deduce it is implementation spe= cific and I don't really hold it against musl. I rewrote everything without= tm_isdst =3D -1. > > > > But there cannot be a case where you have normalized time add something= , normalize and create normalized time that is lower and vice versa. > > > > If you claim otherwise, provide counter example. > > > > I have done pretty extensive testing. > > > > AW > > > > On Sunday, March 24th, 2024 at 19:24, Rich Felker dalias@libc.org wrote= : > > > > > On Sun, Mar 24, 2024 at 06:16:20PM +0000, Alexander Weps wrote: > > > > > > > > And subtracting seconds can't make time go forwards, but that's > > > > > what would happen with the alternate interpretation you want. > > > > > > > > That's just nonsense. > > > > > > > > I can go from 1900 to 2200 by adding seconds. > > > > And from 2200 to 1900 by subtracting seconds. > > > > > > > > I just did that using glibc. > > > > > > > > This is because each addition to struct tz fields leads to time > > > > going forward and each subtraction from struct tz fields leads to > > > > time going backwards.. As it should. > > > > > > > > There is clear ordering of struct tz contents. > > > > > > This is getting really tiring. > > > > > > In the presence of times which do not exist, the properties you want > > > are not mathematically consistent. > > > > > > EITHER you get cases where "start from time T, add something, > > > normalize" gives a broken-down time that looks like it's before T (bu= t > > > isn't, because it's in a different zone rule), > > > > > > OR you get cases where "start from time T, subtract something, > > > normalize" gives a broken-down time that looks like it's after T (bit > > > isn't, because it's in a different zone rule). > > > > > > Preferring one of these nasty behaviors over the other is entirely > > > arbitrary. > > > > > > Time zones are nasty. Local time is nasty. If you want to do things > > > with it, you have to deal with that nastiness. > > > > > > Rich