Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6960277

Browse files
committed
Semi-automatically detect changes in timezone abbreviations.
Add an option to zic.c to dump out all non-obsolete timezone abbreviationsdefined in the Olson database. Comparing this list to its previous statewill clue us in when something happens that we may need to account for inthe tznames/ time zone abbreviation lists. The README file's previousexhortation to "just grep for differences" was completely useless advice,in my now-considerable experience; but maybe this will be a bit moreuseful. As a starting point I built the same list from the tzdata filesas they existed in 2006, which is committed here as known_abbrevs.txt.Comparison indeed turned up quite a few changes we had neglected to accountfor, which I will commit separately.
1 parentb7f8465 commit6960277

File tree

5 files changed

+241
-8
lines changed

5 files changed

+241
-8
lines changed

‎src/timezone/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/zic
2+
/abbrevs.txt

‎src/timezone/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ ifeq (,$(with_system_tzdata))
5555
endif
5656
$(MAKE) -C tznames $@
5757

58+
abbrevs.txt: zic$(TZDATAFILES)
59+
mkdir junkdir
60+
$(ZIC) -P -d junkdir -p'$(POSIXRULES)'$(TZDATAFILES)| LANG=C sort| uniq>abbrevs.txt
61+
rm -rf junkdir
62+
5863
installdirs:
5964
$(MKDIR_P)'$(DESTDIR)$(datadir)'
6065

@@ -65,4 +70,4 @@ endif
6570
$(MAKE) -C tznames $@
6671

6772
cleandistcleanmaintainer-clean:
68-
rm -f zic$(X)$(ZICOBJS)
73+
rm -f zic$(X)$(ZICOBJS) abbrevs.txt

‎src/timezone/README

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,17 @@ Since time zone rules change frequently in some parts of the world,
2222
we should endeavor to update the data files before each PostgreSQL
2323
release.
2424

25-
At each update, we should check if time zone offsets have changed.
26-
Just search for the current or previous year and see what has changed.
27-
Sometimes a country changes its time zone offsets, for example Georgia
28-
in 2004. Just grepping in the zic database files for 2004 is enough to
29-
spot such a change. Then the files under tznames/ should be updated.
25+
While the files under data/ can just be duplicated when updating, manual
26+
effort is needed to update the time zone abbreviation lists under tznames/.
27+
These need to be changed whenever new abbreviations are invented or the
28+
UTC offset associated with an existing abbreviation changes. To detect
29+
if this has happened, after installing new files under data/ do
30+
gmake abbrevs.txt
31+
which will produce a file showing all abbreviations that are in current
32+
use according to the data/ files. Compare this to known_abbrevs.txt,
33+
which is the list that existed last time the tznames/ files were updated.
34+
Update tznames/ as seems appropriate, then replace known_abbrevs.txt
35+
in the same commit.
3036

3137
When there has been a new release of Windows (probably including Service
3238
Packs), the list of matching timezones need to be updated. Run the

‎src/timezone/known_abbrevs.txt

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
ACT-18000
2+
ADDT-7200D
3+
ADT-10800D
4+
ADT14400D
5+
AFT16200
6+
AKST-32400
7+
ALMST25200D
8+
AMT-14400
9+
AMT14400
10+
ANAT39600
11+
APT-10800D
12+
AQTT14400
13+
AQTT18000
14+
ART-10800
15+
AST-14400
16+
AST10800
17+
AWT-10800D
18+
AZOT-3600
19+
AZST18000D
20+
BDT21600
21+
BEAT9000
22+
BEAUT9885
23+
BNT28800
24+
BOT-14400
25+
BRT-10800
26+
BTT21600
27+
CAST10800D
28+
CAT7200
29+
CCT23400
30+
CDT-14400D
31+
CDT-18000D
32+
CDT32400D
33+
CEST7200D
34+
CET3600
35+
CHAST45900
36+
CHOST36000D
37+
CIT28800
38+
CKHST-34200D
39+
CLT-14400
40+
COT-18000
41+
CPT-18000D
42+
CST-21600
43+
CST28800
44+
CST34200
45+
CVT-3600
46+
CWT-18000D
47+
CXT25200
48+
ChST36000
49+
DAVT25200
50+
DDUT36000
51+
EAST-21600
52+
EAT10800
53+
ECT-18000
54+
EDT-14400D
55+
EEST10800D
56+
EET7200
57+
EGST0D
58+
EPT-14400D
59+
EST-18000
60+
EST36000
61+
FJT43200
62+
FKT-10800
63+
FNT-7200
64+
GALT-21600
65+
GAMT-32400
66+
GEST14400D
67+
GFT-10800
68+
GILT43200
69+
GMT0
70+
GMT+1-3600
71+
GMT+10-36000
72+
GMT+11-39600
73+
GMT+12-43200
74+
GMT+2-7200
75+
GMT+3-10800
76+
GMT+4-14400
77+
GMT+5-18000
78+
GMT+6-21600
79+
GMT+7-25200
80+
GMT+8-28800
81+
GMT+9-32400
82+
GMT-13600
83+
GMT-1036000
84+
GMT-1139600
85+
GMT-1243200
86+
GMT-1346800
87+
GMT-1450400
88+
GMT-27200
89+
GMT-310800
90+
GMT-414400
91+
GMT-518000
92+
GMT-621600
93+
GMT-725200
94+
GMT-828800
95+
GMT-932400
96+
GST-7200
97+
GST14400
98+
GYT-14400
99+
HAST-36000
100+
HKT28800
101+
HOVST28800D
102+
HST-36000
103+
ICT25200
104+
ICT28800
105+
IDDT14400D
106+
IOT21600
107+
IRDT16200D
108+
IRKT25200
109+
IST23400D
110+
JST32400
111+
KDT36000D
112+
KGST21600D
113+
KOST43200
114+
KRAT21600
115+
KST28800
116+
LHST39600D
117+
LINT50400
118+
LKT21600
119+
MAGT36000
120+
MART-34200
121+
MAWT21600
122+
MDDT-18000D
123+
MDT-21600D
124+
MET3600
125+
MHT43200
126+
MMT23400
127+
MPT-21600D
128+
MST-25200
129+
MUT14400
130+
MVT18000
131+
MWT-21600D
132+
MYT28800
133+
NCT39600
134+
NDDT-5400D
135+
NFT41400
136+
NOVST25200D
137+
NPT20700
138+
NRT43200
139+
NUT-39600
140+
NZST43200
141+
OMST18000
142+
ORAT18000
143+
PET-18000
144+
PETT39600
145+
PGT36000
146+
PHOT46800
147+
PKT18000
148+
PMDT-7200D
149+
PONT39600
150+
PPT-25200D
151+
PST-28800
152+
PWT-25200D
153+
PWT32400
154+
PYST-10800D
155+
QYZT21600
156+
RET14400
157+
ROTT-10800
158+
SAKT36000
159+
SAMT14400
160+
SAST10800D
161+
SAST7200
162+
SBT39600
163+
SCT14400
164+
SGT28800
165+
SRT-10800
166+
SST-39600
167+
SYOT10800
168+
TAHT-36000
169+
TFT18000
170+
TJT18000
171+
TKT-36000
172+
TMT18000
173+
TOST50400D
174+
TRUT36000
175+
TVT43200
176+
UCT0
177+
ULAST32400D
178+
UTC0
179+
UYHST-9000D
180+
UZT18000
181+
VET-14400
182+
VLAST32400
183+
VOST21600
184+
VUT39600
185+
WAKT43200
186+
WARST-10800D
187+
WART-14400
188+
WAST7200D
189+
WAT-3600
190+
WAT0
191+
WAT3600
192+
WEST3600D
193+
WET0
194+
WFT43200
195+
WGST-7200D
196+
WIT25200
197+
WST-39600
198+
WST28800
199+
YAKT28800
200+
YEKT18000

‎src/timezone/zic.c

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ static intmax_year;
181181
staticzic_tmin_time;
182182
staticintmin_year;
183183
staticintnoise;
184+
staticintprint_abbrevs;
185+
staticzic_tprint_cutoff;
184186
staticconstchar*rfilename;
185187
staticintrlinenum;
186188
staticconstchar*progname;
@@ -457,7 +459,7 @@ static void
457459
usage(FILE*stream,intstatus)
458460
{
459461
(void)fprintf(stream,_("%s: usage is %s \
460-
[ --version ] [ --help ] [ -v ] [ -l localtime ] [ -p posixrules ] \\\n\
462+
[ --version ] [ --help ] [ -v ] [ -P ] [ -l localtime ] [ -p posixrules ] \\\n\
461463
\t[ -d directory ] [ -L leapseconds ] [ -y yearistype ] [ filename ... ]\n\
462464
\n\
463465
Report bugs to tz@elsie.nci.nih.gov.\n"),
@@ -498,7 +500,7 @@ main(int argc, char *argv[])
498500
{
499501
usage(stdout,EXIT_SUCCESS);
500502
}
501-
while ((c=getopt(argc,argv,"d:l:p:L:vsy:"))!=EOF&&c!=-1)
503+
while ((c=getopt(argc,argv,"d:l:p:L:vPsy:"))!=EOF&&c!=-1)
502504
switch (c)
503505
{
504506
default:
@@ -561,6 +563,10 @@ main(int argc, char *argv[])
561563
case'v':
562564
noise= TRUE;
563565
break;
566+
case'P':
567+
print_abbrevs= TRUE;
568+
print_cutoff=time(NULL);
569+
break;
564570
case's':
565571
(void)printf("%s: -s ignored\n",progname);
566572
break;
@@ -1780,6 +1786,21 @@ writezone(const char *name, const char *string)
17801786
puttzcode(gmtoffs[i],fp);
17811787
(void)putc(isdsts[i],fp);
17821788
(void)putc((unsignedchar)indmap[abbrinds[i]],fp);
1789+
1790+
/* Print current timezone abbreviations if requested */
1791+
if (print_abbrevs&&pass==2&&
1792+
(ats[i] >=print_cutoff||i==typecnt-1))
1793+
{
1794+
char*thisabbrev=&thischars[indmap[abbrinds[i]]];
1795+
1796+
/* filter out assorted junk entries */
1797+
if (strcmp(thisabbrev,GRANDPARENTED)!=0&&
1798+
strcmp(thisabbrev,"zzz")!=0)
1799+
fprintf(stdout,"%s\t%ld%s\n",
1800+
thisabbrev,
1801+
gmtoffs[i],
1802+
isdsts[i] ?"\tD" :"");
1803+
}
17831804
}
17841805
if (thischarcnt!=0)
17851806
(void)fwrite((void*)thischars,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp