This patch reverts the following commits because they break some applications that read the binary timezone files directly. References: bnc #879680, bnc# 879512, bnc#879073. commit ebd01ad62ec849fbb6fcda66df4c3e1df1e53d61 Author: Paul Eggert Date: Thu May 1 16:36:16 2014 -0700 * NEWS: Document zic change for low-valued time stamps. commit 7fb077a9ff67dab22b9a23f64f65f85d59cf593e Author: Arthur David Olson Date: Thu May 1 16:32:16 2014 -0700 zic: improve handling of low-valued time stamps * zic.c (writezone, outzone): Arrange things so that binary files include "transition" entries for minimum time values; these entries eliminate localtime guesswork in handling low-valued time stamps. The bad news: binary files grow slightly as a result of these changes. The good news: there are no changes in the output of "zdump -v" applied to before-and-after versions of all the binary files generated by a "make install". commit 2586e998c630cf95a4850d81132203f0901748bc Author: Arthur David Olson Date: Thu May 1 16:25:19 2014 -0700 zic: revert Macquarie-specific changes These were part of commit fada9b7b05339d848f6fcacb4a1c4fd51b49ec7d dated 2013-05-23 12:19:13 -0700. * zic.c (writezone): Don't set type 0 to that of lowest-valued time. (writezone, outzone): Don't reserve type 0. Index: timezone-2014c/zic.c =================================================================== --- timezone-2014c.orig/zic.c +++ timezone-2014c/zic.c @@ -983,6 +983,8 @@ gethms(const char *string, const char *c error(_("time overflow")); return 0; } + if (noise && hh == HOURSPERDAY && mm == 0 && ss == 0) + warning(_("24:00 not handled by pre-1998 versions of zic")); if (noise && (hh > HOURSPERDAY || (hh == HOURSPERDAY && (mm != 0 || ss != 0)))) warning(_("values over 24 hours not handled by pre-2007 versions of zic")); @@ -1501,11 +1503,17 @@ writezone(const char *const name, const fromi = 0; while (fromi < timecnt && attypes[fromi].at < min_time) ++fromi; + /* + ** Remember that type 0 is reserved. + */ + if (isdsts[1] == 0) + while (fromi < timecnt && attypes[fromi].type == 1) + ++fromi; /* handled by default rule */ for ( ; fromi < timecnt; ++fromi) { - if (toi > 1 && ((attypes[fromi].at + + if (toi != 0 && ((attypes[fromi].at + gmtoffs[attypes[toi - 1].type]) <= - (attypes[toi - 1].at + - gmtoffs[attypes[toi - 2].type]))) { + (attypes[toi - 1].at + gmtoffs[toi == 1 ? 0 + : attypes[toi - 2].type]))) { attypes[toi - 1].type = attypes[fromi].type; continue; @@ -1516,9 +1524,6 @@ writezone(const char *const name, const } timecnt = toi; } - if (noise && timecnt > 1200) - warning(_("pre-2014 clients may mishandle" - " more than 1200 transition times")); /* ** Transfer. */ @@ -1550,13 +1555,6 @@ writezone(const char *const name, const --timecnt32; ++timei32; } - /* - ** Output an INT32_MIN "transition" if appropriate--see below. - */ - if (timei32 > 0 && ats[timei32] > INT32_MIN) { - --timei32; - ++timecnt32; - } while (leapcnt32 > 0 && !is32(trans[leapcnt32 - 1])) --leapcnt32; while (leapcnt32 > 0 && !is32(trans[leapi32])) { @@ -1611,7 +1609,11 @@ writezone(const char *const name, const } thistimelim = thistimei + thistimecnt; thisleaplim = thisleapi + thisleapcnt; - for (i = 0; i < typecnt; ++i) + /* + ** Remember that type 0 is reserved. + */ + writetype[0] = FALSE; + for (i = 1; i < typecnt; ++i) writetype[i] = thistimecnt == timecnt; if (thistimecnt == 0) { /* @@ -1627,8 +1629,11 @@ writezone(const char *const name, const /* ** For America/Godthab and Antarctica/Palmer */ + /* + ** Remember that type 0 is reserved. + */ if (thistimei == 0) - writetype[0] = TRUE; + writetype[1] = TRUE; } #ifndef LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH /* @@ -1678,8 +1683,26 @@ writezone(const char *const name, const } #endif /* !defined LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH */ thistypecnt = 0; + /* + ** Potentially, set type 0 to that of lowest-valued time. + */ + if (thistimei > 0) { + for (i = 1; i < typecnt; ++i) + if (writetype[i] && !isdsts[i]) + break; + if (i != types[thistimei - 1]) { + i = types[thistimei - 1]; + gmtoffs[0] = gmtoffs[i]; + isdsts[0] = isdsts[i]; + ttisstds[0] = ttisstds[i]; + ttisgmts[0] = ttisgmts[i]; + abbrinds[0] = abbrinds[i]; + writetype[0] = TRUE; + writetype[i] = FALSE; + } + } for (i = 0; i < typecnt; ++i) - typemap[i] = writetype[i] ? thistypecnt++ : -1; + typemap[i] = writetype[i] ? thistypecnt++ : 0; for (i = 0; i < sizeof indmap / sizeof indmap[0]; ++i) indmap[i] = -1; thischarcnt = 0; @@ -1723,12 +1746,7 @@ writezone(const char *const name, const #undef DO for (i = thistimei; i < thistimelim; ++i) if (pass == 1) - /* - ** Output an INT32_MIN "transition" - ** if appropriate--see above. - */ - puttzcode(((ats[i] < INT32_MIN) ? - INT32_MIN : ats[i]), fp); + puttzcode(ats[i], fp); else puttzcode64(ats[i], fp); for (i = thistimei; i < thistimelim; ++i) { unsigned char uc; @@ -2107,6 +2125,11 @@ outzone(const struct zone * const zpfirs updateminmax(leapminyear); updateminmax(leapmaxyear + (leapmaxyear < ZIC_MAX)); } + /* + ** Reserve type 0. + */ + gmtoffs[0] = isdsts[0] = ttisstds[0] = ttisgmts[0] = abbrinds[0] = -1; + typecnt = 1; for (i = 0; i < zonecount; ++i) { zp = &zpfirst[i]; if (i < zonecount - 1) @@ -2206,7 +2229,8 @@ outzone(const struct zone * const zpfirs if (usestart) { addtt(starttime, type); usestart = FALSE; - } else addtt(min_time, type); + } else if (stdoff != 0) + addtt(min_time, type); } else for (year = min_year; year <= max_year; ++year) { if (useuntil && year > zp->z_untilrule.r_hiyear) break; Index: timezone-2014c/NEWS =================================================================== --- timezone-2014c.orig/NEWS +++ timezone-2014c/NEWS @@ -15,9 +15,6 @@ Release 2014c - 2014-05-13 07:44:13 -070 Changes affecting code - zic now generates transitions for minimum time values, eliminating guesswork - when handling low-valued time stamps. (Thanks to Arthur David Olson.) - Port to Cygwin sans glibc. (Thanks to Arthur David Olson.) Changes affecting commentary and documentation