From 53d5038b3fe50afcd5cb523aad48f88b231fd207 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 6 Sep 2014 16:34:00 -0700 Subject: [PROPOSED PATCH] * zdump.c (main): Fix bug with 'zdump -Vc 1981,1982 Asia/Singapore' missing the end-of-1981 transition. Problem reported by Tim Parenti in: http://mm.icann.org/pipermail/tz/2014-September/021565.html --- NEWS | 3 +++ zdump.c | 9 ++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 91ce1e7..6955f70 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,9 @@ Unreleased, experimental changes Changes affecting code + zdump -c no longer mishandles transitions near year boundaries. + (Thanks to Tim Parenti for reporting the problem.) + An access to uninitalized data has been fixed. (Thanks to Jörg Richter for reporting the problem.) diff --git a/zdump.c b/zdump.c index 2d82fe5..3dfa768 100644 --- a/zdump.c +++ b/zdump.c @@ -654,12 +654,11 @@ main(int argc, char *argv[]) tmp = my_localtime_rz(tz, &t, &tm); if (tmp) ab = saveabbr(&abbrev, &abbrevsize, &tm); - for ( ; ; ) { - newt = (t < absolute_max_time - SECSPERDAY / 2 + while (t < cuthitime) { + newt = ((t < absolute_max_time - SECSPERDAY / 2 + && t + SECSPERDAY / 2 < cuthitime) ? t + SECSPERDAY / 2 - : absolute_max_time); - if (cuthitime <= newt) - break; + : cuthitime); newtmp = localtime_rz(tz, &newt, &newtm); if ((tmp == NULL || newtmp == NULL) ? (tmp != newtmp) : (delta(&newtm, &tm) != (newt - t) || -- 1.9.1