This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/6723] New: mktime() unexpected behaviour if tm_isdst > 1
- From: "Michael dot Ringe at gmx dot de" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 6 Jul 2008 17:52:38 -0000
- Subject: [Bug libc/6723] New: mktime() unexpected behaviour if tm_isdst > 1
- Reply-to: sourceware-bugzilla at sourceware dot org
According to the mktime() manual page, a positive value of tm_isdst means that
DST is in effect. However, mktime() seems to check only for tm_isdst==1, while
any other positive value is treated as "no DST".
Consider this program:
int i;
for (i = 1; i <= 2; ++i) {
struct tm tm;
memset(&tm,0,sizeof(tm));
tm.tm_mday = 1;
tm.tm_mon = 10;
tm.tm_year = 108;
tm.tm_isdst = i;
printf("isdst=%d",tm.tm_isdst);
time_t t = mktime(&tm);
printf(" --> mktime()=%d isdst=%d\n",t,tm.tm_isdst);
}
When running e.g. with TZ=Europe/Berlin, the output is
isdst=1 --> mktime()=1225490400 isdst=0
isdst=2 --> mktime()=1225494000 isdst=0
Of course, the time in question is non-DST, and mktime correctly changes
tm_isdst to 0. But IMHO there are two issues here:
1. The manpage should make clear wether or not the DST offset is
applied in cases like this (take a look, for example, into the
Solaris manpage)
2. All positive values of tm_isdst should produce the same result
--
Summary: mktime() unexpected behaviour if tm_isdst > 1
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper at redhat dot com
ReportedBy: Michael dot Ringe at gmx dot de
CC: glibc-bugs at sources dot redhat dot com
GCC target triplet: Linux/i686
http://sourceware.org/bugzilla/show_bug.cgi?id=6723
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.