Subject: Re: mktime(3) fails to convert a time in the "spring forward gap"
To: Bill Studenmund <wrstuden@netbsd.org>
From: Jun-ichiro itojun Hagino <itojun@iijlab.net>
List: tech-userlevel
Date: 10/10/2002 03:14:59
>> 	FWIW, configure.in shipped with the latest GNU tar also checks
>> 	this and rejects NetBSD mktime(3).
>Is there any standards input on this? Because it seems to me that what our
>mktime is doing is perfectly fine. Those times don't exist on the wall
>clock, so we shouldn't accept them. Just like we say don't accept
>11:09:65.

	still unsure about the standard, but it seems that the test is
	shipped with GNU autoconf 2.54 (functions.m4).  so every software
	that ships with configure script built by autoconf 2.54 will fail.
	anyone know contact address for Mr Andreas Jaeger?

itojun


--- from functions.m4

/* Fail if mktime fails to convert a date in the spring-forward gap.
   Based on a problem report from Andreas Jaeger.  */
static void
spring_forward_gap ()
{
  /* glibc (up to about 1998-10-07) failed this test. */
  struct tm tm;

  /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
     instead of "TZ=America/Vancouver" in order to detect the bug even
     on systems that don't support the Olson extension, or don't have the
     full zoneinfo tables installed.  */
  putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");

  tm.tm_year = 98;
  tm.tm_mon = 3;
  tm.tm_mday = 5;
  tm.tm_hour = 2;
  tm.tm_min = 0;
  tm.tm_sec = 0;
  tm.tm_isdst = -1;
  if (mktime (&tm) == (time_t)-1)
    exit (1);
}