From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14820 invoked by alias); 17 Apr 2002 12:45:20 -0000 Mailing-List: contact libc-hacker-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sources.redhat.com Received: (qmail 14799 invoked from network); 17 Apr 2002 12:45:15 -0000 Received: from unknown (HELO sunsite.mff.cuni.cz) (195.113.19.66) by sources.redhat.com with SMTP; 17 Apr 2002 12:45:15 -0000 Received: (from jakub@localhost) by sunsite.mff.cuni.cz (8.11.6/8.11.6) id g3HCj7u20452; Wed, 17 Apr 2002 14:45:07 +0200 Date: Wed, 17 Apr 2002 05:45:00 -0000 From: Jakub Jelinek To: Thorsten Kukuk Cc: Glibc hackers Subject: [PATCH] tst-mktime.c Message-ID: <20020417144507.Y32482@sunsite.ms.mff.cuni.cz> Reply-To: Jakub Jelinek References: <20020413115942.N32482@sunsite.ms.mff.cuni.cz> <20020417142145.A9522@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20020417142145.A9522@suse.de>; from kukuk@suse.de on Wed, Apr 17, 2002 at 02:21:46PM +0200 X-SW-Source: 2002-04/txt/msg00061.txt.bz2 On Wed, Apr 17, 2002 at 02:21:46PM +0200, Thorsten Kukuk wrote: > On Sat, Apr 13, Jakub Jelinek wrote: > > > Hi! > > > > The PR libc/2738 fix was not entirely correct, since even tm with tm_year 69 > > is representable in certain timezones. This caused e.g. perl-Date-Calc tests > > to fail. Below is a fix. Years before 69 surely cannot be represented, for > > 69 it computes the year and checks for overflow afterwards. > > > > 2002-04-13 Jakub Jelinek > > > > * time/mktime.c (__mktime_internal): If year is 69, don't bail out > > early, but check whether it overflowed afterwards. > > * time/tst-mktime.c (main): Add new tests. > > make check does not longer pass for me with this. Output of > tst-mktime.out is: > > Wednesday > Dec 31 1969 EST test passed > mktime returned 3749, expected -1 Weird, I get Wednesday Dec 31 1969 EST test passed Dec 31 1969 CET test passed on all arches I've bootstrapped it (i386,i686,ia64,alpha,alphaev6). Looks like tst-mktime cannot find the CET zone file on your box. Does the following work for you? Passes for me with current glibc, fails with: Wednesday mktime returned -1, expected 3749 Dec 31 1969 CET test passed with glibc before my mktime patch (expected). 2002-04-17 Jakub Jelinek * time/tst-mktime.c: Include . Use %d, not %ld format for EVENING69. Include offsets in TZ environment variable. --- libc/time/tst-mktime.c.jj Wed Apr 17 14:34:34 2002 +++ libc/time/tst-mktime.c Wed Apr 17 14:48:32 2002 @@ -1,3 +1,4 @@ +#include #include #include #include @@ -30,7 +31,7 @@ main (void) result = strcmp (daybuf, "Wednesday") != 0; } - setenv ("TZ", "EST", 1); + setenv ("TZ", "EST+5", 1); #define EVENING69 1 * 60 * 60 + 2 * 60 + 29 t = EVENING69; tm = localtime (&t); @@ -45,14 +46,14 @@ main (void) t = mktime (&time_str); if (t != EVENING69) { - printf ("mktime returned %ld, expected %ld\n", + printf ("mktime returned %ld, expected %d\n", (long) t, EVENING69); result = 1; } else (void) puts ("Dec 31 1969 EST test passed"); - setenv ("TZ", "CET", 1); + setenv ("TZ", "CET-1", 1); t = mktime (&time_str); if (t != (time_t) -1) { Jakub