public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "aurelien at aurel32 dot net" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug time/31144] New: mktime: returns clock for UTC with isdst=1
Date: Tue, 12 Dec 2023 05:46:31 +0000	[thread overview]
Message-ID: <bug-31144-131@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 31144
           Summary: mktime: returns clock for UTC with isdst=1
           Product: glibc
           Version: unspecified
               URL: http://bugs.debian.org/1057856
            Status: NEW
          Severity: normal
          Priority: P2
         Component: time
          Assignee: unassigned at sourceware dot org
          Reporter: aurelien at aurel32 dot net
  Target Milestone: ---

Created attachment 15253
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15253&action=edit
Reproducer

A Debian user reported a behaviour change of the mktime function affecting
Erlang/OTP. When passing isdst=1 with an UTC timezone, a time is now returned
(with isdst=0), while in the past it returned an error.

The issue has been tracked to the following commit
83859e1115269cf56d21669361d4ddbe2687831c which went into 2.37, and got
backported to the 2.34, 2.35 and 2.36 branches.

The C standard is not fully clear about the behaviour in that case:

"A positive or 0 value for tm_isdst shall cause mktime() to presume initially
that Daylight Savings Time, respectively, is or is not in effect for the
specified time. A negative value for tm_isdst shall cause mktime() to attempt
to determine whether Daylight Savings Time is in effect for the specified
time."

However it appears that the original GNU libc behaviour before that commit
matches the FreeBSD libc behaviour.

The user provided a small test program to exercise the issue (see attachement):

$ gcc -o check_dst check_dst.c
$ TZ=UTC ./check_dst 0 
tzname[0]: UTC, tzname[1]: UTC
        dst before: 0
        dst after: 0
        clock: 1217548800
$ TZ=UTC ./check_dst 1
tzname[0]: UTC, tzname[1]: UTC
        dst before: 1
        dst after: 0
        clock: 1217545200

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

             reply	other threads:[~2023-12-12  5:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12  5:46 aurelien at aurel32 dot net [this message]
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
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@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).