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 AF2BE214C5 for ; Sun, 24 Mar 2024 19:37:03 +0100 (CET) Received: (qmail 11884 invoked by uid 550); 24 Mar 2024 18:32:20 -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 11846 invoked from network); 24 Mar 2024 18:32:20 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1711305410; x=1711564610; bh=UL/a8li0KWfsv8jai/HSXoeJE9CVGwJQ6TxjkXq5wV8=; 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=cq0vKWwCD0dCFzZawSAy7U471tWvfsdrQy6wwYIyzdgZ78uI//WrSbHIrCRPVj3ku l9jKT7PS+c42zWZ1x/ABiQuFGJ2ttgluH249hK1iMczJPjy3ZKfJGwHyGdU5T6UY0g EpSScodH75pZafovM94CEbdM+AkjruR1gw8YdwiL0RlNCh+4PWYIZZNEtoqmhyrxq7 lfaWVjyst9twKFAZW1EbL7Dy2iLXZwWsHhW/vkU9DcHsslDN3z7O7OUYfY4jXgNFmY p2UtoqTAakw1ALA/YUMdiUMBJ2kzRPl9e/Ijje7yvYimCW6+DOCuksiwfpS03sP94W 7P8NUzJfxtcCA== Date: Sun, 24 Mar 2024 18:36:40 +0000 To: Rich Felker From: Alexander Weps Cc: musl@lists.openwall.com, Daniel Gutson , Markus Wichmann Message-ID: <9c2qfe36CoPBfKjzn1lDDZ_hfyNJCZW6-6ZTZlQgHAPr2djicIMMweEqUoQoQsDWsBt4AAZBL8vZlcsVCL950rYhcPpMDvhzDWean3oVHbs=@pm.me> In-Reply-To: <20240324182458.GX4163@brightrain.aerifal.cx> References: <20240324170436.GV4163@brightrain.aerifal.cx> <0_9-JV2MW3avVvzhE9vjqKqCX0fEZy0uUuZKIohFGEFDBY912nwZyxZe560H0cf_b8L2gD8e0eUAUp2Q3e1rmra3XEppx9HPhhFeulwLYZA=@pm.me> <20240324180200.GW4163@brightrain.aerifal.cx> <20240324182458.GX4163@brightrain.aerifal.cx> 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 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, normaliz= e, 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, nor= malize, 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 not = apply. I agree that the decision how to deduce it is implementation specifi= c 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, no= rmalize 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 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