Skip to content

Commit 909e48d

Browse files
committed
Fix bogus logic for zic -P option.
The quick hack I added to zic to dump out currently-in-use timezone abbreviations turns out to have a nasty bug: within each zone, it was printing the last "struct ttinfo" to be *defined*, not necessarily the last one in use. This was mainly a problem in zones that had changed the meaning of their zone abbreviation (to another GMT offset value) and later changed it back. As a result of this error, we'd missed out updating the tznames/ files for some jurisdictions that have changed their zone abbreviations since the tznames/ files were originally created. I'll address the missing data updates in a separate commit.
1 parent 67ed9d5 commit 909e48d

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

src/timezone/zic.c

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,7 +1770,25 @@ writezone(const char *name, const char *string)
17701770
if (pass == 1)
17711771
puttzcode((long) ats[i], fp);
17721772
else
1773+
{
17731774
puttzcode64(ats[i], fp);
1775+
1776+
/* Print current timezone abbreviations if requested */
1777+
if (print_abbrevs &&
1778+
(ats[i] >= print_cutoff || i == thistimelim - 1))
1779+
{
1780+
unsigned char tm = typemap[types[i]];
1781+
char *thisabbrev = &thischars[indmap[abbrinds[tm]]];
1782+
1783+
/* filter out assorted junk entries */
1784+
if (strcmp(thisabbrev, GRANDPARENTED) != 0 &&
1785+
strcmp(thisabbrev, "zzz") != 0)
1786+
fprintf(stdout, "%s\t%ld%s\n",
1787+
thisabbrev,
1788+
gmtoffs[tm],
1789+
isdsts[tm] ? "\tD" : "");
1790+
}
1791+
}
17741792
for (i = thistimei; i < thistimelim; ++i)
17751793
{
17761794
unsigned char uc;
@@ -1787,21 +1805,6 @@ writezone(const char *name, const char *string)
17871805
puttzcode(gmtoffs[i], fp);
17881806
(void) putc(isdsts[i], fp);
17891807
(void) putc((unsigned char) indmap[abbrinds[i]], fp);
1790-
1791-
/* Print current timezone abbreviations if requested */
1792-
if (print_abbrevs && pass == 2 &&
1793-
(ats[i] >= print_cutoff || i == typecnt - 1))
1794-
{
1795-
char *thisabbrev = &thischars[indmap[abbrinds[i]]];
1796-
1797-
/* filter out assorted junk entries */
1798-
if (strcmp(thisabbrev, GRANDPARENTED) != 0 &&
1799-
strcmp(thisabbrev, "zzz") != 0)
1800-
fprintf(stdout, "%s\t%ld%s\n",
1801-
thisabbrev,
1802-
gmtoffs[i],
1803-
isdsts[i] ? "\tD" : "");
1804-
}
18051808
}
18061809
if (thischarcnt != 0)
18071810
(void) fwrite((void *) thischars,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy