@@ -107,15 +107,15 @@ static bool typesequiv(struct state const *, int, int);
107
107
108
108
static struct pg_tm tm ;
109
109
110
- /* Initialize *S to a value based on GMTOFF , ISDST, and ABBRIND . */
110
+ /* Initialize *S to a value based on UTOFF , ISDST, and DESIGIDX . */
111
111
static void
112
- init_ttinfo (struct ttinfo * s , int32 gmtoff , bool isdst , int abbrind )
112
+ init_ttinfo (struct ttinfo * s , int32 utoff , bool isdst , int desigidx )
113
113
{
114
- s -> tt_gmtoff = gmtoff ;
114
+ s -> tt_utoff = utoff ;
115
115
s -> tt_isdst = isdst ;
116
- s -> tt_abbrind = abbrind ;
116
+ s -> tt_desigidx = desigidx ;
117
117
s -> tt_ttisstd = false;
118
- s -> tt_ttisgmt = false;
118
+ s -> tt_ttisut = false;
119
119
}
120
120
121
121
static int32
@@ -251,7 +251,7 @@ tzloadbody(char const *name, char *canonname, struct state *sp, bool doextend,
251
251
for (stored = 4 ; stored <= 8 ; stored *= 2 )
252
252
{
253
253
int32 ttisstdcnt = detzcode (up -> tzhead .tzh_ttisstdcnt );
254
- int32 ttisgmtcnt = detzcode (up -> tzhead .tzh_ttisgmtcnt );
254
+ int32 ttisutcnt = detzcode (up -> tzhead .tzh_ttisutcnt );
255
255
int64 prevtr = 0 ;
256
256
int32 prevcorr = 0 ;
257
257
int32 leapcnt = detzcode (up -> tzhead .tzh_leapcnt );
@@ -270,7 +270,7 @@ tzloadbody(char const *name, char *canonname, struct state *sp, bool doextend,
270
270
&& 0 <= timecnt && timecnt < TZ_MAX_TIMES
271
271
&& 0 <= charcnt && charcnt < TZ_MAX_CHARS
272
272
&& (ttisstdcnt == typecnt || ttisstdcnt == 0 )
273
- && (ttisgmtcnt == typecnt || ttisgmtcnt == 0 )))
273
+ && (ttisutcnt == typecnt || ttisutcnt == 0 )))
274
274
return EINVAL ;
275
275
if (nread
276
276
< (tzheadsize /* struct tzhead */
@@ -280,7 +280,7 @@ tzloadbody(char const *name, char *canonname, struct state *sp, bool doextend,
280
280
+ charcnt /* chars */
281
281
+ leapcnt * (stored + 4 ) /* lsinfos */
282
282
+ ttisstdcnt /* ttisstds */
283
- + ttisgmtcnt )) /* ttisgmts */
283
+ + ttisutcnt )) /* ttisuts */
284
284
return EINVAL ;
285
285
sp -> leapcnt = leapcnt ;
286
286
sp -> timecnt = timecnt ;
@@ -332,19 +332,19 @@ tzloadbody(char const *name, char *canonname, struct state *sp, bool doextend,
332
332
{
333
333
struct ttinfo * ttisp ;
334
334
unsigned char isdst ,
335
- abbrind ;
335
+ desigidx ;
336
336
337
337
ttisp = & sp -> ttis [i ];
338
- ttisp -> tt_gmtoff = detzcode (p );
338
+ ttisp -> tt_utoff = detzcode (p );
339
339
p += 4 ;
340
340
isdst = * p ++ ;
341
341
if (!(isdst < 2 ))
342
342
return EINVAL ;
343
343
ttisp -> tt_isdst = isdst ;
344
- abbrind = * p ++ ;
345
- if (!(abbrind < sp -> charcnt ))
344
+ desigidx = * p ++ ;
345
+ if (!(desigidx < sp -> charcnt ))
346
346
return EINVAL ;
347
- ttisp -> tt_abbrind = abbrind ;
347
+ ttisp -> tt_desigidx = desigidx ;
348
348
}
349
349
for (i = 0 ; i < sp -> charcnt ; ++ i )
350
350
sp -> chars [i ] = * p ++ ;
@@ -398,13 +398,13 @@ tzloadbody(char const *name, char *canonname, struct state *sp, bool doextend,
398
398
struct ttinfo * ttisp ;
399
399
400
400
ttisp = & sp -> ttis [i ];
401
- if (ttisgmtcnt == 0 )
402
- ttisp -> tt_ttisgmt = false;
401
+ if (ttisutcnt == 0 )
402
+ ttisp -> tt_ttisut = false;
403
403
else
404
404
{
405
405
if (* p != true && * p != false)
406
406
return EINVAL ;
407
- ttisp -> tt_ttisgmt = * p ++ ;
407
+ ttisp -> tt_ttisut = * p ++ ;
408
408
}
409
409
}
410
410
@@ -438,13 +438,13 @@ tzloadbody(char const *name, char *canonname, struct state *sp, bool doextend,
438
438
439
439
for (i = 0 ; i < ts -> typecnt ; i ++ )
440
440
{
441
- char * tsabbr = ts -> chars + ts -> ttis [i ].tt_abbrind ;
441
+ char * tsabbr = ts -> chars + ts -> ttis [i ].tt_desigidx ;
442
442
int j ;
443
443
444
444
for (j = 0 ; j < charcnt ; j ++ )
445
445
if (strcmp (sp -> chars + j , tsabbr ) == 0 )
446
446
{
447
- ts -> ttis [i ].tt_abbrind = j ;
447
+ ts -> ttis [i ].tt_desigidx = j ;
448
448
gotabbr ++ ;
449
449
break ;
450
450
}
@@ -456,7 +456,7 @@ tzloadbody(char const *name, char *canonname, struct state *sp, bool doextend,
456
456
{
457
457
strcpy (sp -> chars + j , tsabbr );
458
458
charcnt = j + tsabbrlen + 1 ;
459
- ts -> ttis [i ].tt_abbrind = j ;
459
+ ts -> ttis [i ].tt_desigidx = j ;
460
460
gotabbr ++ ;
461
461
}
462
462
}
@@ -614,12 +614,13 @@ typesequiv(const struct state *sp, int a, int b)
614
614
const struct ttinfo * ap = & sp -> ttis [a ];
615
615
const struct ttinfo * bp = & sp -> ttis [b ];
616
616
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 ));
623
624
}
624
625
return result ;
625
626
}
@@ -1176,7 +1177,7 @@ tzparse(const char *name, struct state *sp, bool lastditch)
1176
1177
if (!sp -> ttis [j ].tt_isdst )
1177
1178
{
1178
1179
theirstdoffset =
1179
- - sp -> ttis [j ].tt_gmtoff ;
1180
+ - sp -> ttis [j ].tt_utoff ;
1180
1181
break ;
1181
1182
}
1182
1183
}
@@ -1187,7 +1188,7 @@ tzparse(const char *name, struct state *sp, bool lastditch)
1187
1188
if (sp -> ttis [j ].tt_isdst )
1188
1189
{
1189
1190
theirdstoffset =
1190
- - sp -> ttis [j ].tt_gmtoff ;
1191
+ - sp -> ttis [j ].tt_utoff ;
1191
1192
break ;
1192
1193
}
1193
1194
}
@@ -1206,7 +1207,7 @@ tzparse(const char *name, struct state *sp, bool lastditch)
1206
1207
{
1207
1208
j = sp -> types [i ];
1208
1209
sp -> types [i ] = sp -> ttis [j ].tt_isdst ;
1209
- if (sp -> ttis [j ].tt_ttisgmt )
1210
+ if (sp -> ttis [j ].tt_ttisut )
1210
1211
{
1211
1212
/* No adjustment to transition time */
1212
1213
}
@@ -1234,7 +1235,7 @@ tzparse(const char *name, struct state *sp, bool lastditch)
1234
1235
theirstdoffset ;
1235
1236
}
1236
1237
}
1237
- theiroffset = - sp -> ttis [j ].tt_gmtoff ;
1238
+ theiroffset = - sp -> ttis [j ].tt_utoff ;
1238
1239
if (sp -> ttis [j ].tt_isdst )
1239
1240
theirdstoffset = theiroffset ;
1240
1241
else
@@ -1357,14 +1358,14 @@ localsub(struct state const *sp, pg_time_t const *timep,
1357
1358
1358
1359
/*
1359
1360
* 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 ;
1361
1362
* timesub(&t, 0L, sp, tmp);
1362
1363
*/
1363
- result = timesub (& t , ttisp -> tt_gmtoff , sp , tmp );
1364
+ result = timesub (& t , ttisp -> tt_utoff , sp , tmp );
1364
1365
if (result )
1365
1366
{
1366
1367
result -> tm_isdst = ttisp -> tt_isdst ;
1367
- result -> tm_zone = unconstify (char * , & sp -> chars [ttisp -> tt_abbrind ]);
1368
+ result -> tm_zone = unconstify (char * , & sp -> chars [ttisp -> tt_desigidx ]);
1368
1369
}
1369
1370
return result ;
1370
1371
}
@@ -1647,7 +1648,7 @@ pg_next_dst_boundary(const pg_time_t *timep,
1647
1648
break ;
1648
1649
}
1649
1650
ttisp = & sp -> ttis [i ];
1650
- * before_gmtoff = ttisp -> tt_gmtoff ;
1651
+ * before_gmtoff = ttisp -> tt_utoff ;
1651
1652
* before_isdst = ttisp -> tt_isdst ;
1652
1653
return 0 ;
1653
1654
}
@@ -1700,7 +1701,7 @@ pg_next_dst_boundary(const pg_time_t *timep,
1700
1701
/* No known transition > t, so use last known segment's type */
1701
1702
i = sp -> types [sp -> timecnt - 1 ];
1702
1703
ttisp = & sp -> ttis [i ];
1703
- * before_gmtoff = ttisp -> tt_gmtoff ;
1704
+ * before_gmtoff = ttisp -> tt_utoff ;
1704
1705
* before_isdst = ttisp -> tt_isdst ;
1705
1706
return 0 ;
1706
1707
}
@@ -1715,13 +1716,13 @@ pg_next_dst_boundary(const pg_time_t *timep,
1715
1716
break ;
1716
1717
}
1717
1718
ttisp = & sp -> ttis [i ];
1718
- * before_gmtoff = ttisp -> tt_gmtoff ;
1719
+ * before_gmtoff = ttisp -> tt_utoff ;
1719
1720
* before_isdst = ttisp -> tt_isdst ;
1720
1721
* boundary = sp -> ats [0 ];
1721
1722
/* And for "after", use the first segment's type */
1722
1723
i = sp -> types [0 ];
1723
1724
ttisp = & sp -> ttis [i ];
1724
- * after_gmtoff = ttisp -> tt_gmtoff ;
1725
+ * after_gmtoff = ttisp -> tt_utoff ;
1725
1726
* after_isdst = ttisp -> tt_isdst ;
1726
1727
return 1 ;
1727
1728
}
@@ -1743,12 +1744,12 @@ pg_next_dst_boundary(const pg_time_t *timep,
1743
1744
}
1744
1745
j = sp -> types [i - 1 ];
1745
1746
ttisp = & sp -> ttis [j ];
1746
- * before_gmtoff = ttisp -> tt_gmtoff ;
1747
+ * before_gmtoff = ttisp -> tt_utoff ;
1747
1748
* before_isdst = ttisp -> tt_isdst ;
1748
1749
* boundary = sp -> ats [i ];
1749
1750
j = sp -> types [i ];
1750
1751
ttisp = & sp -> ttis [j ];
1751
- * after_gmtoff = ttisp -> tt_gmtoff ;
1752
+ * after_gmtoff = ttisp -> tt_utoff ;
1752
1753
* after_isdst = ttisp -> tt_isdst ;
1753
1754
return 1 ;
1754
1755
}
@@ -1832,9 +1833,9 @@ pg_interpret_timezone_abbrev(const char *abbrev,
1832
1833
for (i = cutoff - 1 ; i >= 0 ; i -- )
1833
1834
{
1834
1835
ttisp = & sp -> ttis [sp -> types [i ]];
1835
- if (ttisp -> tt_abbrind == abbrind )
1836
+ if (ttisp -> tt_desigidx == abbrind )
1836
1837
{
1837
- * gmtoff = ttisp -> tt_gmtoff ;
1838
+ * gmtoff = ttisp -> tt_utoff ;
1838
1839
* isdst = ttisp -> tt_isdst ;
1839
1840
return true;
1840
1841
}
@@ -1846,9 +1847,9 @@ pg_interpret_timezone_abbrev(const char *abbrev,
1846
1847
for (i = cutoff ; i < sp -> timecnt ; i ++ )
1847
1848
{
1848
1849
ttisp = & sp -> ttis [sp -> types [i ]];
1849
- if (ttisp -> tt_abbrind == abbrind )
1850
+ if (ttisp -> tt_desigidx == abbrind )
1850
1851
{
1851
- * gmtoff = ttisp -> tt_gmtoff ;
1852
+ * gmtoff = ttisp -> tt_utoff ;
1852
1853
* isdst = ttisp -> tt_isdst ;
1853
1854
return true;
1854
1855
}
@@ -1875,10 +1876,10 @@ pg_get_timezone_offset(const pg_tz *tz, long int *gmtoff)
1875
1876
sp = & tz -> state ;
1876
1877
for (i = 1 ; i < sp -> typecnt ; i ++ )
1877
1878
{
1878
- if (sp -> ttis [i ].tt_gmtoff != sp -> ttis [0 ].tt_gmtoff )
1879
+ if (sp -> ttis [i ].tt_utoff != sp -> ttis [0 ].tt_utoff )
1879
1880
return false;
1880
1881
}
1881
- * gmtoff = sp -> ttis [0 ].tt_gmtoff ;
1882
+ * gmtoff = sp -> ttis [0 ].tt_utoff ;
1882
1883
return true;
1883
1884
}
1884
1885
0 commit comments