Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Dec 1999 14:14:23 +0100
From:      Andre Albsmeier <andre.albsmeier@mchp.siemens.de>
To:        freebsd-questions@freebsd.org
Subject:   mktime(), why does it fail?
Message-ID:  <19991215141423.A98888@internal>

next in thread | raw e-mail | index | archive | help
When trying to compile gnu tar-1.13, configure tries do determine
if mktime() works. This fails; the following program demonstrates why:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

void main ()
{   
  time_t t;
  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;
  t=mktime(&tm);
  printf("%lu, ", t);
  if (t== (time_t)-1) {
    printf("Error\n");
    exit (1);
  }
  printf("OK\n");
}


Now my question: Why does the mktime() call above not succeed under
FreeBSD-3.4-RC? I think it should...

	-Andre

-- 
"In a world without walls and fences, who needs windows and gates?"


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991215141423.A98888>