From owner-freebsd-questions Wed Dec 15 12:28:36 1999 Delivered-To: freebsd-questions@freebsd.org Received: from donhm.calcasieu.com (dread.austin.texas.net [206.127.24.91]) by hub.freebsd.org (Postfix) with ESMTP id EE4FF1523D for ; Wed, 15 Dec 1999 12:27:46 -0800 (PST) (envelope-from dread@donhm.calcasieu.com) Received: (from dread@localhost) by donhm.calcasieu.com (8.9.3/8.9.3) id OAA18004; Wed, 15 Dec 1999 14:27:09 -0600 (CST) (envelope-from dread) Message-ID: X-Mailer: XFMail 1.3 [p0] on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <19991215141423.A98888@internal> Date: Wed, 15 Dec 1999 14:27:08 -0600 (CST) From: Don Read To: Andre Albsmeier Subject: RE: mktime(), why does it fail? Cc: freebsd-questions@FreeBSD.ORG Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 >#include >#include > > 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