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 E9D8D3858D28 for ; Thu, 19 Jan 2023 04:34:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E9D8D3858D28 Authentication-Results: sourceware.org; dmarc=pass (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 AC866160054; Wed, 18 Jan 2023 20:34:07 -0800 (PST) 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 VutlQZqpPLk6; Wed, 18 Jan 2023 20:34:06 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id B303F160064; Wed, 18 Jan 2023 20:34:06 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.9.2 zimbra.cs.ucla.edu B303F160064 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=78364E5A-2AF3-11ED-87FA-8298ECA2D365; t=1674102846; bh=AHEgShCzlI/5H1Zza7sPKOFy/z7AveOvoT1RLoLkTnU=; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type: Content-Transfer-Encoding; b=F2aw71RsIuTqLdE9gD8SCsRb+Uin2Vq0H1/ZscgbrFQETRqJKYVKsJdeV2OqFgQAB eHbX/EO8Ub96yG4m2ogk9xI/TwhGmKAb6/a48li+MjxR1vfE3G5vwIjiLAwngB2T7r 7W9XMJ+UtWa/6mBdPr8r5Cm9E5BU6/3mj8mRZqU0= 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 R1YKSxlhzrY5; Wed, 18 Jan 2023 20:34:06 -0800 (PST) Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 99174160054; Wed, 18 Jan 2023 20:34:06 -0800 (PST) Message-ID: <040c6e3a-e65d-972e-d644-f363c0536cc5@cs.ucla.edu> Date: Wed, 18 Jan 2023 20:34:06 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: mktime result may depend on previous calls Content-Language: en-US To: Max Nikulin , libc-alpha@sourceware.org References: <3dc4be13-a454-3cd5-6a83-d9dfa4c3d7dd@cs.ucla.edu> From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,JMQ_SPF_NEUTRAL,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 1/18/23 19:00, Max Nikulin via Libc-alpha wrote: > Paul, thank you for clarification. Should some note be added to the doc= s? The actual behavior is reasonably complicated. As a time nerd I'm=20 probably the wrong person to ask about whether it should be documented. >=20 > ---- >8 ---- > Notice that in the case of ambiguous local time (around a transition=20 > with backward step) multiple mktime calls with the same argument may=20 > return both values. Such kind of uncertainty appears if tm_isdst is set= =20 > to -1 or if local time changes keeping the same DST state. > ---- 8< ---- The above wording isn't quite right, as it ignores the role of tm_gmtoff=20 in mktime. (Did I say it was complicated? :-) > It even might be used as a non-portable way of disambiguation: just add= =20 > an extra call of mktime well aside from the backward time step. Too=20 > weird to use it in practice though. Unfortunately POSIX does not allow=20 > anything like >=20 > https://www.python.org/dev/peps/pep-0495/ > PEP 495 =E2=80=93 Local Time Disambiguation (Python) POSIX does allow that sort of thing as an extension, and glibc mktime=20 does so: it disambiguates via tm_gmtoff.