mirror of
https://frontier.innolan.net/rainlance/amiga-tz.git
synced 2026-05-06 23:37:29 +00:00
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".
This commit is contained in:
committed by
Paul Eggert
parent
2586e998c6
commit
7fb077a9ff
26
zic.c
26
zic.c
@@ -1480,14 +1480,11 @@ writezone(const char *const name, const char *const string, char version)
|
||||
fromi = 0;
|
||||
while (fromi < timecnt && attypes[fromi].at < min_time)
|
||||
++fromi;
|
||||
if (isdsts[0] == 0)
|
||||
while (fromi < timecnt && attypes[fromi].type == 0)
|
||||
++fromi; /* handled by default rule */
|
||||
for ( ; fromi < timecnt; ++fromi) {
|
||||
if (toi != 0 && ((attypes[fromi].at +
|
||||
if (toi > 1 && ((attypes[fromi].at +
|
||||
gmtoffs[attypes[toi - 1].type]) <=
|
||||
(attypes[toi - 1].at + gmtoffs[toi == 1 ? 0
|
||||
: attypes[toi - 2].type]))) {
|
||||
(attypes[toi - 1].at +
|
||||
gmtoffs[attypes[toi - 2].type]))) {
|
||||
attypes[toi - 1].type =
|
||||
attypes[fromi].type;
|
||||
continue;
|
||||
@@ -1532,6 +1529,13 @@ writezone(const char *const name, const char *const string, char version)
|
||||
--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])) {
|
||||
@@ -1698,7 +1702,12 @@ writezone(const char *const name, const char *const string, char version)
|
||||
#undef DO
|
||||
for (i = thistimei; i < thistimelim; ++i)
|
||||
if (pass == 1)
|
||||
puttzcode(ats[i], fp);
|
||||
/*
|
||||
** Output an INT32_MIN "transition"
|
||||
** if appropriate--see above.
|
||||
*/
|
||||
puttzcode(((ats[i] < INT32_MIN) ?
|
||||
INT32_MIN : ats[i]), fp);
|
||||
else puttzcode64(ats[i], fp);
|
||||
for (i = thistimei; i < thistimelim; ++i) {
|
||||
unsigned char uc;
|
||||
@@ -2176,8 +2185,7 @@ outzone(const struct zone * const zpfirst, const int zonecount)
|
||||
if (usestart) {
|
||||
addtt(starttime, type);
|
||||
usestart = FALSE;
|
||||
} else if (stdoff != 0)
|
||||
addtt(min_time, type);
|
||||
} else addtt(min_time, type);
|
||||
} else for (year = min_year; year <= max_year; ++year) {
|
||||
if (useuntil && year > zp->z_untilrule.r_hiyear)
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user