Skip to content

Commit 5968570

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 1021bd6 commit 5968570

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
@@ -1766,7 +1766,25 @@ writezone(const char *name, const char *string)
17661766
if (pass == 1)
17671767
puttzcode((long) ats[i], fp);
17681768
else
1769+
{
17691770
puttzcode64(ats[i], fp);
1771+
1772+
/* Print current timezone abbreviations if requested */
1773+
if (print_abbrevs &&
1774+
(ats[i] >= print_cutoff || i == thistimelim - 1))
1775+
{
1776+
unsigned char tm = typemap[types[i]];
1777+
char *thisabbrev = &thischars[indmap[abbrinds[tm]]];
1778+
1779+
/* filter out assorted junk entries */
1780+
if (strcmp(thisabbrev, GRANDPARENTED) != 0 &&
1781+
strcmp(thisabbrev, "zzz") != 0)
1782+
fprintf(stdout, "%s\t%ld%s\n",
1783+
thisabbrev,
1784+
gmtoffs[tm],
1785+
isdsts[tm] ? "\tD" : "");
1786+
}
1787+
}
17701788
for (i = thistimei; i < thistimelim; ++i)
17711789
{
17721790
unsigned char uc;
@@ -1783,21 +1801,6 @@ writezone(const char *name, const char *string)
17831801
puttzcode(gmtoffs[i], fp);
17841802
(void) putc(isdsts[i], fp);
17851803
(void) putc((unsigned char) indmap[abbrinds[i]], fp);
1786-
1787-
/* Print current timezone abbreviations if requested */
1788-
if (print_abbrevs && pass == 2 &&
1789-
(ats[i] >= print_cutoff || i == typecnt - 1))
1790-
{
1791-
char *thisabbrev = &thischars[indmap[abbrinds[i]]];
1792-
1793-
/* filter out assorted junk entries */
1794-
if (strcmp(thisabbrev, GRANDPARENTED) != 0 &&
1795-
strcmp(thisabbrev, "zzz") != 0)
1796-
fprintf(stdout, "%s\t%ld%s\n",
1797-
thisabbrev,
1798-
gmtoffs[i],
1799-
isdsts[i] ? "\tD" : "");
1800-
}
18011804
}
18021805
if (thischarcnt != 0)
18031806
(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