zdump loop problem

Andreas Radke a.radke at arcor.de
Tue Dec 2 17:35:53 UTC 2008


tested this with our default -O2 optimisation:

--- zdump.c	2008-09-10 02:33:24.000000000 +0000
+++ zdump.c.new	2008-12-02 17:29:22.442966381 +0000
@@ -349,11 +349,9 @@
 			(void) strncpy(buf, abbr(&tm), (sizeof buf) - 1);
 		}
 		for ( ; ; ) {
-			if (t >= cuthitime)
-				break;
-			newt = t + SECSPERHOUR * 12;
-			if (newt >= cuthitime)
-				break;
+			if (t >= cuthitime || t >= cuthitime - SECSPERHOUR * 12)
+ 				break;
+ 			newt = t + SECSPERHOUR * 12;
 			if (newt <= t)
 				break;
 			newtmp = localtime(&newt);

and it seems to work well now:

[andyrtr at workstation64 trunk]$  zdump -v EUROPE/BERLIN
EUROPE/BERLIN  Fri Dec 13 20:45:52 1901 UTC = Fri Dec 13 20:45:52 1901 GMT isdst=0
EUROPE/BERLIN  Sat Dec 14 20:45:52 1901 UTC = Sat Dec 14 20:45:52 1901 GMT isdst=0
EUROPE/BERLIN  Mon Jan 18 03:14:07 2038 UTC = Mon Jan 18 03:14:07 2038 GMT isdst=0
EUROPE/BERLIN  Tue Jan 19 03:14:07 2038 UTC = Tue Jan 19 03:14:07 2038 GMT isdst=0

(if this result is what it should be :S)

-Andy



More information about the tz mailing list