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

Commitccc323b

Browse files
committed
Sync our copy of the timezone library with IANA release tzcode2019b.
A large fraction of this diff is just due to upstream's somewhatrandom decision to rename a bunch of internal variables and structfields. However, there is an interesting new feature in zic:it's grown a "-b slim" option that emits zone files without 32-bitdata and other backwards-compatibility hacks. We should considerwhether we wish to enable that.
1 parent583025c commitccc323b

File tree

5 files changed

+305
-267
lines changed

5 files changed

+305
-267
lines changed

‎src/timezone/README

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ match properly on the old version.
5555
Time Zone code
5656
==============
5757

58-
The code in this directory is currently synced with tzcode release2019a.
58+
The code in this directory is currently synced with tzcode release2019b.
5959
There are many cosmetic (and not so cosmetic) differences from the
6060
original tzcode library, but diffs in the upstream version should usually
6161
be propagated to our version. Here are some notes about that.
@@ -127,4 +127,7 @@ and then run them through pgindent. (The first three sed patterns deal
127127
with conversion of their block comment style to something pgindent
128128
won't make a hash of; the remainder address other points noted above.)
129129
After that, the files can be diff'd directly against our corresponding
130-
files.
130+
files. Also, it's typically helpful to diff against the previous tzcode
131+
release (after processing that the same way), and then try to apply the
132+
diff to our files. This will take care of most of the changes
133+
mechanically.

‎src/timezone/localtime.c

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@ static bool typesequiv(struct state const *, int, int);
107107

108108
staticstructpg_tmtm;
109109

110-
/* Initialize *S to a value based onGMTOFF, ISDST, andABBRIND. */
110+
/* Initialize *S to a value based onUTOFF, ISDST, andDESIGIDX. */
111111
staticvoid
112-
init_ttinfo(structttinfo*s,int32gmtoff,boolisdst,intabbrind)
112+
init_ttinfo(structttinfo*s,int32utoff,boolisdst,intdesigidx)
113113
{
114-
s->tt_gmtoff=gmtoff;
114+
s->tt_utoff=utoff;
115115
s->tt_isdst=isdst;
116-
s->tt_abbrind=abbrind;
116+
s->tt_desigidx=desigidx;
117117
s->tt_ttisstd= false;
118-
s->tt_ttisgmt= false;
118+
s->tt_ttisut= false;
119119
}
120120

121121
staticint32
@@ -251,7 +251,7 @@ tzloadbody(char const *name, char *canonname, struct state *sp, bool doextend,
251251
for (stored=4;stored <=8;stored *=2)
252252
{
253253
int32ttisstdcnt=detzcode(up->tzhead.tzh_ttisstdcnt);
254-
int32ttisgmtcnt=detzcode(up->tzhead.tzh_ttisgmtcnt);
254+
int32ttisutcnt=detzcode(up->tzhead.tzh_ttisutcnt);
255255
int64prevtr=0;
256256
int32prevcorr=0;
257257
int32leapcnt=detzcode(up->tzhead.tzh_leapcnt);
@@ -270,7 +270,7 @@ tzloadbody(char const *name, char *canonname, struct state *sp, bool doextend,
270270
&&0 <=timecnt&&timecnt<TZ_MAX_TIMES
271271
&&0 <=charcnt&&charcnt<TZ_MAX_CHARS
272272
&& (ttisstdcnt==typecnt||ttisstdcnt==0)
273-
&& (ttisgmtcnt==typecnt||ttisgmtcnt==0)))
273+
&& (ttisutcnt==typecnt||ttisutcnt==0)))
274274
returnEINVAL;
275275
if (nread
276276
< (tzheadsize/* struct tzhead */
@@ -280,7 +280,7 @@ tzloadbody(char const *name, char *canonname, struct state *sp, bool doextend,
280280
+charcnt/* chars */
281281
+leapcnt* (stored+4)/* lsinfos */
282282
+ttisstdcnt/* ttisstds */
283-
+ttisgmtcnt))/*ttisgmts */
283+
+ttisutcnt))/*ttisuts */
284284
returnEINVAL;
285285
sp->leapcnt=leapcnt;
286286
sp->timecnt=timecnt;
@@ -332,19 +332,19 @@ tzloadbody(char const *name, char *canonname, struct state *sp, bool doextend,
332332
{
333333
structttinfo*ttisp;
334334
unsignedcharisdst,
335-
abbrind;
335+
desigidx;
336336

337337
ttisp=&sp->ttis[i];
338-
ttisp->tt_gmtoff=detzcode(p);
338+
ttisp->tt_utoff=detzcode(p);
339339
p+=4;
340340
isdst=*p++;
341341
if (!(isdst<2))
342342
returnEINVAL;
343343
ttisp->tt_isdst=isdst;
344-
abbrind=*p++;
345-
if (!(abbrind<sp->charcnt))
344+
desigidx=*p++;
345+
if (!(desigidx<sp->charcnt))
346346
returnEINVAL;
347-
ttisp->tt_abbrind=abbrind;
347+
ttisp->tt_desigidx=desigidx;
348348
}
349349
for (i=0;i<sp->charcnt;++i)
350350
sp->chars[i]=*p++;
@@ -398,13 +398,13 @@ tzloadbody(char const *name, char *canonname, struct state *sp, bool doextend,
398398
structttinfo*ttisp;
399399

400400
ttisp=&sp->ttis[i];
401-
if (ttisgmtcnt==0)
402-
ttisp->tt_ttisgmt= false;
401+
if (ttisutcnt==0)
402+
ttisp->tt_ttisut= false;
403403
else
404404
{
405405
if (*p!= true&&*p!= false)
406406
returnEINVAL;
407-
ttisp->tt_ttisgmt=*p++;
407+
ttisp->tt_ttisut=*p++;
408408
}
409409
}
410410

@@ -438,13 +438,13 @@ tzloadbody(char const *name, char *canonname, struct state *sp, bool doextend,
438438

439439
for (i=0;i<ts->typecnt;i++)
440440
{
441-
char*tsabbr=ts->chars+ts->ttis[i].tt_abbrind;
441+
char*tsabbr=ts->chars+ts->ttis[i].tt_desigidx;
442442
intj;
443443

444444
for (j=0;j<charcnt;j++)
445445
if (strcmp(sp->chars+j,tsabbr)==0)
446446
{
447-
ts->ttis[i].tt_abbrind=j;
447+
ts->ttis[i].tt_desigidx=j;
448448
gotabbr++;
449449
break;
450450
}
@@ -456,7 +456,7 @@ tzloadbody(char const *name, char *canonname, struct state *sp, bool doextend,
456456
{
457457
strcpy(sp->chars+j,tsabbr);
458458
charcnt=j+tsabbrlen+1;
459-
ts->ttis[i].tt_abbrind=j;
459+
ts->ttis[i].tt_desigidx=j;
460460
gotabbr++;
461461
}
462462
}
@@ -614,12 +614,13 @@ typesequiv(const struct state *sp, int a, int b)
614614
conststructttinfo*ap=&sp->ttis[a];
615615
conststructttinfo*bp=&sp->ttis[b];
616616

617-
result=ap->tt_gmtoff==bp->tt_gmtoff&&
618-
ap->tt_isdst==bp->tt_isdst&&
619-
ap->tt_ttisstd==bp->tt_ttisstd&&
620-
ap->tt_ttisgmt==bp->tt_ttisgmt&&
621-
strcmp(&sp->chars[ap->tt_abbrind],
622-
&sp->chars[bp->tt_abbrind])==0;
617+
result= (ap->tt_utoff==bp->tt_utoff
618+
&&ap->tt_isdst==bp->tt_isdst
619+
&&ap->tt_ttisstd==bp->tt_ttisstd
620+
&&ap->tt_ttisut==bp->tt_ttisut
621+
&& (strcmp(&sp->chars[ap->tt_desigidx],
622+
&sp->chars[bp->tt_desigidx])
623+
==0));
623624
}
624625
returnresult;
625626
}
@@ -1176,7 +1177,7 @@ tzparse(const char *name, struct state *sp, bool lastditch)
11761177
if (!sp->ttis[j].tt_isdst)
11771178
{
11781179
theirstdoffset=
1179-
-sp->ttis[j].tt_gmtoff;
1180+
-sp->ttis[j].tt_utoff;
11801181
break;
11811182
}
11821183
}
@@ -1187,7 +1188,7 @@ tzparse(const char *name, struct state *sp, bool lastditch)
11871188
if (sp->ttis[j].tt_isdst)
11881189
{
11891190
theirdstoffset=
1190-
-sp->ttis[j].tt_gmtoff;
1191+
-sp->ttis[j].tt_utoff;
11911192
break;
11921193
}
11931194
}
@@ -1206,7 +1207,7 @@ tzparse(const char *name, struct state *sp, bool lastditch)
12061207
{
12071208
j=sp->types[i];
12081209
sp->types[i]=sp->ttis[j].tt_isdst;
1209-
if (sp->ttis[j].tt_ttisgmt)
1210+
if (sp->ttis[j].tt_ttisut)
12101211
{
12111212
/* No adjustment to transition time */
12121213
}
@@ -1234,7 +1235,7 @@ tzparse(const char *name, struct state *sp, bool lastditch)
12341235
theirstdoffset;
12351236
}
12361237
}
1237-
theiroffset=-sp->ttis[j].tt_gmtoff;
1238+
theiroffset=-sp->ttis[j].tt_utoff;
12381239
if (sp->ttis[j].tt_isdst)
12391240
theirdstoffset=theiroffset;
12401241
else
@@ -1357,14 +1358,14 @@ localsub(struct state const *sp, pg_time_t const *timep,
13571358

13581359
/*
13591360
* To get (wrong) behavior that's compatible with System V Release 2.0
1360-
* you'd replace the statement below with t += ttisp->tt_gmtoff;
1361+
* you'd replace the statement below with t += ttisp->tt_utoff;
13611362
* timesub(&t, 0L, sp, tmp);
13621363
*/
1363-
result=timesub(&t,ttisp->tt_gmtoff,sp,tmp);
1364+
result=timesub(&t,ttisp->tt_utoff,sp,tmp);
13641365
if (result)
13651366
{
13661367
result->tm_isdst=ttisp->tt_isdst;
1367-
result->tm_zone= (char*)&sp->chars[ttisp->tt_abbrind];
1368+
result->tm_zone= (char*)&sp->chars[ttisp->tt_desigidx];
13681369
}
13691370
returnresult;
13701371
}
@@ -1647,7 +1648,7 @@ pg_next_dst_boundary(const pg_time_t *timep,
16471648
break;
16481649
}
16491650
ttisp=&sp->ttis[i];
1650-
*before_gmtoff=ttisp->tt_gmtoff;
1651+
*before_gmtoff=ttisp->tt_utoff;
16511652
*before_isdst=ttisp->tt_isdst;
16521653
return0;
16531654
}
@@ -1700,7 +1701,7 @@ pg_next_dst_boundary(const pg_time_t *timep,
17001701
/* No known transition > t, so use last known segment's type */
17011702
i=sp->types[sp->timecnt-1];
17021703
ttisp=&sp->ttis[i];
1703-
*before_gmtoff=ttisp->tt_gmtoff;
1704+
*before_gmtoff=ttisp->tt_utoff;
17041705
*before_isdst=ttisp->tt_isdst;
17051706
return0;
17061707
}
@@ -1715,13 +1716,13 @@ pg_next_dst_boundary(const pg_time_t *timep,
17151716
break;
17161717
}
17171718
ttisp=&sp->ttis[i];
1718-
*before_gmtoff=ttisp->tt_gmtoff;
1719+
*before_gmtoff=ttisp->tt_utoff;
17191720
*before_isdst=ttisp->tt_isdst;
17201721
*boundary=sp->ats[0];
17211722
/* And for "after", use the first segment's type */
17221723
i=sp->types[0];
17231724
ttisp=&sp->ttis[i];
1724-
*after_gmtoff=ttisp->tt_gmtoff;
1725+
*after_gmtoff=ttisp->tt_utoff;
17251726
*after_isdst=ttisp->tt_isdst;
17261727
return1;
17271728
}
@@ -1743,12 +1744,12 @@ pg_next_dst_boundary(const pg_time_t *timep,
17431744
}
17441745
j=sp->types[i-1];
17451746
ttisp=&sp->ttis[j];
1746-
*before_gmtoff=ttisp->tt_gmtoff;
1747+
*before_gmtoff=ttisp->tt_utoff;
17471748
*before_isdst=ttisp->tt_isdst;
17481749
*boundary=sp->ats[i];
17491750
j=sp->types[i];
17501751
ttisp=&sp->ttis[j];
1751-
*after_gmtoff=ttisp->tt_gmtoff;
1752+
*after_gmtoff=ttisp->tt_utoff;
17521753
*after_isdst=ttisp->tt_isdst;
17531754
return1;
17541755
}
@@ -1832,9 +1833,9 @@ pg_interpret_timezone_abbrev(const char *abbrev,
18321833
for (i=cutoff-1;i >=0;i--)
18331834
{
18341835
ttisp=&sp->ttis[sp->types[i]];
1835-
if (ttisp->tt_abbrind==abbrind)
1836+
if (ttisp->tt_desigidx==abbrind)
18361837
{
1837-
*gmtoff=ttisp->tt_gmtoff;
1838+
*gmtoff=ttisp->tt_utoff;
18381839
*isdst=ttisp->tt_isdst;
18391840
return true;
18401841
}
@@ -1846,9 +1847,9 @@ pg_interpret_timezone_abbrev(const char *abbrev,
18461847
for (i=cutoff;i<sp->timecnt;i++)
18471848
{
18481849
ttisp=&sp->ttis[sp->types[i]];
1849-
if (ttisp->tt_abbrind==abbrind)
1850+
if (ttisp->tt_desigidx==abbrind)
18501851
{
1851-
*gmtoff=ttisp->tt_gmtoff;
1852+
*gmtoff=ttisp->tt_utoff;
18521853
*isdst=ttisp->tt_isdst;
18531854
return true;
18541855
}
@@ -1875,10 +1876,10 @@ pg_get_timezone_offset(const pg_tz *tz, long int *gmtoff)
18751876
sp=&tz->state;
18761877
for (i=1;i<sp->typecnt;i++)
18771878
{
1878-
if (sp->ttis[i].tt_gmtoff!=sp->ttis[0].tt_gmtoff)
1879+
if (sp->ttis[i].tt_utoff!=sp->ttis[0].tt_utoff)
18791880
return false;
18801881
}
1881-
*gmtoff=sp->ttis[0].tt_gmtoff;
1882+
*gmtoff=sp->ttis[0].tt_utoff;
18821883
return true;
18831884
}
18841885

‎src/timezone/pgtz.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525

2626
structttinfo
2727
{/* time type information */
28-
int32tt_gmtoff;/* UT offset in seconds */
28+
int32tt_utoff;/* UT offset in seconds */
2929
booltt_isdst;/* used to set tm_isdst */
30-
inttt_abbrind;/* abbreviation list index */
30+
inttt_desigidx;/* abbreviation list index */
3131
booltt_ttisstd;/* transition is std time */
32-
booltt_ttisgmt;/* transition is UT */
32+
booltt_ttisut;/* transition is UT */
3333
};
3434

3535
structlsinfo

‎src/timezone/tzfile.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ struct tzhead
4141
chartzh_magic[4];/* TZ_MAGIC */
4242
chartzh_version[1];/* '\0' or '2' or '3' as of 2013 */
4343
chartzh_reserved[15];/* reserved; must be zero */
44-
chartzh_ttisgmtcnt[4];/* coded number of trans. time flags */
44+
chartzh_ttisutcnt[4];/* coded number of trans. time flags */
4545
chartzh_ttisstdcnt[4];/* coded number of trans. time flags */
4646
chartzh_leapcnt[4];/* coded number of leap seconds */
4747
chartzh_timecnt[4];/* coded number of transition times */
@@ -64,14 +64,15 @@ struct tzhead
6464
*one (char [4])total correction after above
6565
*tzh_ttisstdcnt (char)sindexed by type; if 1, transition
6666
*time is standard time, if 0,
67-
*transition time is wall clock time
68-
*if absent, transition times are
69-
*assumed to be wall clock time
70-
*tzh_ttisgmtcnt (char)sindexed by type; if 1, transition
71-
*time is UT, if 0,
72-
*transition time is local time
73-
*if absent, transition times are
67+
*transition time is local (wall clock)
68+
*time; if absent, transition times are
7469
*assumed to be local time
70+
*tzh_ttisutcnt (char)sindexed by type; if 1, transition
71+
*time is UT, if 0, transition time is
72+
*local time; if absent, transition
73+
*times are assumed to be local time.
74+
*When this is 1, the corresponding
75+
*std/wall indicator must also be 1.
7576
*/
7677

7778
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp