public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug time/31144] New: mktime: returns clock for UTC with isdst=1
@ 2023-12-12  5:46 aurelien at aurel32 dot net
  2023-12-12  5:49 ` [Bug time/31144] " aurelien at aurel32 dot net
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: aurelien at aurel32 dot net @ 2023-12-12  5:46 UTC (permalink / raw)
  To: glibc-bugs

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-12-13 17:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-12  5:46 [Bug time/31144] New: mktime: returns clock for UTC with isdst=1 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
2023-12-13 10:11 ` fweimer at redhat dot com
2023-12-13 17:52 ` eggert at cs dot ucla.edu

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).