@@ -107,15 +107,15 @@ static bool typesequiv(struct state const *, int, int);
107107
108108static struct pg_tm tm ;
109109
110- /* Initialize *S to a value based on GMTOFF , ISDST, and ABBRIND . */
110+ /* Initialize *S to a value based on UTOFF , ISDST, and DESIGIDX . */
111111static 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 )
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
121121static int32
@@ -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 int32 ttisstdcnt = detzcode (up -> tzhead .tzh_ttisstdcnt );
254- int32 ttisgmtcnt = detzcode (up -> tzhead .tzh_ttisgmtcnt );
254+ int32 ttisutcnt = detzcode (up -> tzhead .tzh_ttisutcnt );
255255 int64 prevtr = 0 ;
256256 int32 prevcorr = 0 ;
257257 int32 leapcnt = 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 return EINVAL ;
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 return EINVAL ;
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 struct ttinfo * ttisp ;
334334 unsigned char isdst ,
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 return EINVAL ;
343343 ttisp -> tt_isdst = isdst ;
344- abbrind = * p ++ ;
345- if (!(abbrind < sp -> charcnt ))
344+ desigidx = * p ++ ;
345+ if (!(desigidx < sp -> charcnt ))
346346 return EINVAL ;
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 struct ttinfo * 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 return EINVAL ;
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 int j ;
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 const struct ttinfo * ap = & sp -> ttis [a ];
615615 const struct ttinfo * 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 return result ;
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 return result ;
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 return 0 ;
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 return 0 ;
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 return 1 ;
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 return 1 ;
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
0 commit comments