FW: America/Chicago zone vs mktime w/tm_isdst!=-1

Olson, Arthur David (NIH/NCI) olsona at dc37a.nci.nih.gov
Tue Nov 25 12:40:28 UTC 2003

Dan Nelson is not on the time zone mailing list; direct replies


-----Original Message-----
From: Dan Nelson [mailto:dnelson at allantgroup.com] 
Sent: Monday, November 24, 2003 6:23 PM
To: tz at lecserver.nci.nih.gov
Subject: America/Chicago zone vs mktime w/tm_isdst!=-1

Here's an interesting problem.  Usually when mktime() is called with
tm_isdst set to 0 or 1, it will interpret the original time as being either
in standard or daylight time according to tm_isdst, and update the resulting
time_t value (and the struct tm) if the DST flag was wrong.

This doesn't seem to happen with the America/Chicago zone.  I've attached a
simple program that passes three struct tm's to mktime, with three values of
tm_isdst each.  For most zones, the first and last times change depending on
what value of tm_isdst is passed in.  For America/Chicago, it looks like
tm_isdst is ignored.  Is it used correctly for the middle time (since it's
in the fall-back range).

Someone filed a FreeBSD PR against this back in June (
http://www.freebsd.org/cgi/query-pr.cgi?pr=53899 ), and I've verified the
behaviour back to FreeBSD 4.0 (which had imported tzcode1999a). 
The classictzcode.tar.gz on elsie.nci.nih.gov looks at tm_isdst in all
cases, so the change happened sometime between 1994 and 1999.  I don't know
if there are archives of tzcode sources, or I could pinpoint the exact

It's not strictly a bug since POSIX basically says that any tm_isdst != -1
results in implementation-defined behaviour, but it's troublesome if the
behaviour changes from zone to zone, and the current releases of Solaris,
Tru64, AIX, and glibc(Linux) are consistent across timezones (they all
adjust the incoming struct tm based on tm_isdst).

And, a couple of POSIX/C99 links for the archives:


	Dan Nelson
	dnelson at allantgroup.com

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mktimetest.c
URL: <http://mm.icann.org/pipermail/tz/attachments/20031125/f981ab6b/attachment.c>

More information about the tz mailing list