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 6631822A55 for ; Sun, 24 Mar 2024 20:07:16 +0100 (CET) Received: (qmail 30446 invoked by uid 550); 24 Mar 2024 19:02: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 30411 invoked from network); 24 Mar 2024 19:02:33 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1711307223; x=1711566423; bh=P7xEUgPWIGZPaL7cSI0z0S79aRqQJaCnwwf5AflF3Zs=; 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=I/5nz8Wt/HeqAsuHjInInTcO/5C8SoanAjnTNmWwnLUlUGU789j37py4AEbO6fLp0 ltuq38JBRo91m6lO6eZe7ik5vlzaFLfkJZtvQcD5vbg5vVfVp/qBNgdpBOKmSuGs93 wZKE8F5bL2/5YJ3EbJ1CavNCegijC5+YJAQ19UBz7ec6+yy9S7h/hbCoukwWsSuWE2 fv86h2Kv+ExR3ye3GNnpRNKIVn4W1RySRDq1MrgraUrJ+85P7Hegh347bhLhaOPAYy 8r10RrMjE8JnaAzdRiUSha1s6a/s727E9jOfq1A7LZnppxC257Oq4IieG33YWAScBH V58aCe8evfojg== Date: Sun, 24 Mar 2024 19:06:58 +0000 To: Rich Felker From: Alexander Weps Cc: musl@lists.openwall.com, Daniel Gutson , Markus Wichmann Message-ID: <3yixwTENdfygkyC-VpJQ3EN-X6RgOM_A9EYuLzX0CgM_wOfDncIPUkyoj7RQkfdPk_IvYOo6gNwao8cHNiWkNoZoa8DhvJk3i0fYp1mC1fU=@pm.me> In-Reply-To: <9c2qfe36CoPBfKjzn1lDDZ_hfyNJCZW6-6ZTZlQgHAPr2djicIMMweEqUoQoQsDWsBt4AAZBL8vZlcsVCL950rYhcPpMDvhzDWean3oVHbs=@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> 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 ran Asia/Omsk from 1900 to 2200 there and back again (59 seconds incremen= ts/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 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, normal= ize, 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, n= ormalize, you should always get normalized time T1, which is lower than T2. > > I agree than for non normalized time (tm_isdst =3D -1 etc.) this would no= t apply. I agree that the decision how to deduce it is implementation speci= fic and I don't really hold it against musl. I rewrote everything without t= m_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 (but > > 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