Originally sent to the wrong email address - sorry. ---------- Forwarded message ---------- From: Jonathan Leffler <jonathan.leffler@gmail.com> Date: Mon, Dec 8, 2008 at 12:14 PM Subject: Re: zdump loop problem To: Robbin Kawabata <Robbin.Kawabata@sun.com> Cc: tz@lecserver.nci.nih.gov, a.radke@arcor.de On Mon, Dec 8, 2008 at 11:50 AM, Robbin Kawabata <Robbin.Kawabata@sun.com>wrote:
I ran ado's fix against all the timezones, and got good results.
This is the diff:
*** zdump_loop.c Tue Dec 2 11:17:01 2008 --- zdump_fix_ado.c Tue Dec 2 12:49:05 2008 *************** *** 312,322 **** (void) strncpy(buf, abbr(&tm), sizeof (buf) - 1); } for (;;) { ! if (t >= cuthitime) break; newt = t + SECSPERHOUR * 12; - if (newt >= cuthitime) - break; if (newt <= t) break; newtmp = localtime(&newt); --- 312,320 ---- (void) strncpy(buf, abbr(&tm), sizeof (buf) - 1); } for (;;) { ! if (t >= cuthitime || t >= cuthitime - SECSPERHOUR * 12) break;
Isn't that code equivalent to just: if (t >= cuthitime - SECSPERHOUR * 12) I've not followed all the details of the thread, but AFAIUI, this code is protecting against overflow on positive quantities (rather than underflow on negative ones), and the double test is redundant unless cuthitime is within 12 * SECPERHOUR of the smallest (most negative) integer.
newt = t + SECSPERHOUR * 12; if (newt <= t) break; newtmp = localtime(&newt);
However, isn't the check for "if (newt <= t) break" no longer needed?
Probably...
----- Begin Forwarded Message -----
Date: Mon, 01 Dec 2008 16:21:00 -0500 From: "Olson, Arthur David (NIH/NCI) [E]" <olsona@dc37a.nci.nih.gov> Subject: Re: zdump loop problem To: tz@lecserver.nci.nih.gov Cc: Andreas Radke <a.radke@arcor.de>
So...in the real world, does changing the zic.c lines reading... if (t >= cuthitime) break; newt = t + SECSPERHOUR * 12; if (newt >= cuthitime) break; ...to read... if (t >= cuthitime || t >= cuthitime - SECSPERHOUR * 12) break; newt = t + SECSPERHOUR * 12; ...result in working code? I'd particularly appreciate feedback from Andreas Radke or other ArchLinux users.
----- End Forwarded Message -----
-- Jonathan Leffler <jonathan.leffler@gmail.com> #include <disclaimer.h> Guardian of DBD::Informix - v2008.0513 - http://dbi.perl.org "Blessed are we who can laugh at ourselves, for we shall never cease to be amused."
participants (1)
-
Jonathan Leffler