FW: mktime bug?

Olson, Arthur David (NCI) olsona at dc37a.nci.nih.gov
Thu May 13 00:47:13 UTC 1999


Be sure to direct replies to Guido, who's not on the time zone mailing list.

				--ado

-----Original Message-----
From:	Guido Flohr [SMTP:gufl0000 at stud.uni-sb.de]
Sent:	Wednesday, May 12, 1999 8:43 PM
To:	tz at elsie.nci.nih.gov
Subject:	mktime bug?

Hi,

sorry, it's me again.  I have problems with this little piece of code:

bash$ cat >mktimetest <<EOF
#include <stdio.h>
#include <time.h>

int main ()
{
  struct tm tm;
  time_t secs;

  memset (&tm, 0, sizeof tm);
  tm.year = 99;
  tm.mon = 4;
  tm.mday = 13;
  secs = mktime (&tm);
  printf ("secs: %ld (%s)\n", secs, strerror (errno));
  return 0;
}
EOF
# make mktimetest
# TZ=CET-1CEST-2 ./mktimetest
secs: -1 (OK)

On installations where summertime applies during May mktime returns an
error here (happens somewhere in the function time2).  If I set

	tm.tm_isdst = -1;

before calling mktime() the function returns the correct time.

I have fixed that by inserting the line

	tmp->tm_isdst = -1;

in mktime() before time1() gets called but I'm not sure if this is the
right place to do that (or if this is correct at all).

Can you verify that behavior or have I messed up my sources?  If it is a
bug, how should it be fixed?

Thanks

Guido
-- 
http://stud.uni-sb.de/~gufl0000
mailto:gufl0000 at stud.uni-sb.de



More information about the tz mailing list