From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zimbra.cs.ucla.edu (zimbra.cs.ucla.edu [131.179.128.68]) by sourceware.org (Postfix) with ESMTPS id 96B1F3858D1E for ; Thu, 18 Aug 2022 03:02:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 96B1F3858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=cs.ucla.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cs.ucla.edu Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 126371600C0; Wed, 17 Aug 2022 20:02:37 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id l5En38wl7DHn; Wed, 17 Aug 2022 20:02:36 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 3A4021600C2; Wed, 17 Aug 2022 20:02:36 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id VpMKS3SKmu7A; Wed, 17 Aug 2022 20:02:36 -0700 (PDT) Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 129C41600C0; Wed, 17 Aug 2022 20:02:36 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------irQwdg9G00Ad4LdzMIWuDSAw" Message-ID: <4e2b42bf-b103-72fc-ab79-5ddfaa8f32da@cs.ucla.edu> Date: Wed, 17 Aug 2022 20:02:35 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Content-Language: en-US To: DJ Delorie Cc: libc-alpha@sourceware.org References: From: Paul Eggert Organization: UCLA Computer Science Department Subject: Re: [swbz 29035] mktime vs non-DST In-Reply-To: X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2022 03:02:39 -0000 This is a multi-part message in MIME format. --------------irQwdg9G00Ad4LdzMIWuDSAw Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 8/17/22 18:39, DJ Delorie wrote: > It does stop mktime from returning -1 in the problem case, but it still > returns a different value than pre-2.29. Older code returned the > standard time result, your patches return a DST result, even if the zone > has no DST. Actually, the old (glibc 2.28) code could return a standard time result even in zones with DST, and this led to results that weren't self-consistent. For example, suppose we use the attached program to ask mktime "What time is it in Fiji on July 1 at 00:00 DST for the two years 2029 and 2030?" Although Fiji no longer observes DST (it stopped last year), the old glibc code does this: 2029-07-31 23:00:00 +1300 +13 2030-08-01 00:00:00 +1300 +13 whereas Gnulib (and glibc with the proposed patches) does this: 2029-07-31 23:00:00 +1300 +13 2030-07-31 23:00:00 +1300 +13 The old code is inconsistent with itself, because it gets confused by the DST that Fiji stopped observing in in 2021. The new code is consistent with itself, as well as with similar questions asked about New York, Los Angeles, etc. when you ask for a DST during a day that DST is not observed. There is no perfection in this area because the mktime API is busted (though POSIX may improve it if they listen to me :-). That being said, the Gnulib mktime behavior should be better than the old glibc behavior for the great majority of users. --------------irQwdg9G00Ad4LdzMIWuDSAw Content-Type: text/x-csrc; charset=UTF-8; name="uu.c" Content-Disposition: attachment; filename="uu.c" Content-Transfer-Encoding: base64 I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPHRpbWUu aD4KCnZvaWQKY2hlY2tfeWVhciAoaW50IHllYXIpCnsKICBzdHJ1Y3QgdG0gdG07CiAgdG0u dG1feWVhciA9IHllYXIgLSAxOTAwOwogIHRtLnRtX21vbiA9IDc7CiAgdG0udG1fbWRheSA9 IDE7CiAgdG0udG1faG91ciA9IHRtLnRtX21pbiA9IHRtLnRtX3NlYyA9IDA7CiAgdG0udG1f aXNkc3QgPSAxOwogIHRpbWVfdCB0ID0gbWt0aW1lICgmdG0pOwogIGlmICh0ICE9ICh0aW1l X3QpIC0xKQogICAgewogICAgICBjaGFyIGJ1ZlsxMDAwXTsKICAgICAgc3RyZnRpbWUgKGJ1 Ziwgc2l6ZW9mIGJ1ZiwgIiVZLSVtLSVkICVIOiVNOiVTICV6ICVaIiwgJnRtKTsKICAgICAg cHV0cyAoYnVmKTsKICAgIH0KfQoKaW50Cm1haW4gKHZvaWQpCnsKICBzZXRlbnYgKCJUWiIs ICJQYWNpZmljL0FwaWEiLCAxKTsKICBjaGVja195ZWFyICgyMDI5KTsKICBjaGVja195ZWFy ICgyMDMwKTsKfQo= --------------irQwdg9G00Ad4LdzMIWuDSAw--