public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "eggert at cs dot ucla.edu" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug time/31144] mktime: returns clock for UTC with isdst=1
Date: Tue, 12 Dec 2023 23:37:01 +0000	[thread overview]
Message-ID: <bug-31144-131-qRi7CihjSd@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-31144-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=31144

eggert at cs dot ucla.edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |NOTABUG

--- Comment #2 from eggert at cs dot ucla.edu ---
The C and POSIX standards do not specify what mktime should do with examples
like this, so this is not a conformance issue. As Andreas mentioned, tm_isdst
is intended as a hint for ambiguous timestamps; unfortunately this does not
suffice in general for TZDB Zones, e.g., 1971-10-31 02:30 when
TZ='Europe/London' because at 03:00 standard time moved back by an hour in
London so there are two distinct matching timestamps both with tm_isdst==0, one
with time_t==57720600 and one with time_t==57724200. So the whole area is a bit
of an ill-thought-out mess.

glibc currently supports the idea that if you want to find a time that's 1 year
from now you can call localtime, add 1 to tm_year, and then call mktime on the
result, and you'll get a timestamp that's 1 year later or thereabouts (the
concept of "one year later" is not well-defined). This idea didn't work with
older glibc (and I guess FreeBSD libc?) if DST is in use now but not 1 year
from now (or vice versa) because in those cases older glibc mktime simply
failed.

In practice the new glibc behavior seems to be more useful than the old one.
The old behavior was changed in response to a real-world use case
<https://bugs.gnu.org/48085> whereas the Erlang/OTP issue is an artificial test
case which is a weaker argument.

With that in mind I'm going to resolve this as NOTABUG. The Erlang/OTP test
case is wrong because it's making assumptions about mktime that are not present
in the relative standards

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2023-12-12 23:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12  5:46 [Bug time/31144] New: " aurelien at aurel32 dot net
2023-12-12  5:49 ` [Bug time/31144] " aurelien at aurel32 dot net
2023-12-12  9:40 ` schwab@linux-m68k.org
2023-12-12 23:37 ` eggert at cs dot ucla.edu [this message]
2023-12-13 10:11 ` fweimer at redhat dot com
2023-12-13 17:52 ` eggert at cs dot ucla.edu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-31144-131-qRi7CihjSd@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).