Date: Wed, 15 Dec 1999 14:27:08 -0600 (CST) From: Don Read <dread@texas.net> To: Andre Albsmeier <andre.albsmeier@mchp.siemens.de> Cc: freebsd-questions@FreeBSD.ORG Subject: RE: mktime(), why does it fail? Message-ID: <XFMail.991215142708.dread@texas.net> In-Reply-To: <19991215141423.A98888@internal>
next in thread | previous in thread | raw e-mail | index | archive | help
On 15-Dec-99 Andre Albsmeier wrote:
> 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...
The date 1998-4-5 is a DST change, 02:00 goes -> 03:00
thus no 2am.
Why it sez "Error" I have no idea, because this is exactly what this prog is
testing for.
Does "POSIX.1" say this should succeed ?
Regards,
--
Don Read dread@calcasieu.com
EDP Manager dread@texas.net
Calcasieu Lumber Co. Austin TX
-- No Coffee No Peace
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?XFMail.991215142708.dread>
