summaryrefslogtreecommitdiff
path: root/src/timezone/zic.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-04-30 15:13:51 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2017-04-30 15:14:11 -0400
commit4d4d8fa77eb81c949dc52ffcb401a476fffddb2c (patch)
treef64f793b4600220a7b9f2b5c47545a608455ea53 /src/timezone/zic.c
parenta0291c33070d7095bc8aa4f21a1f6ccf714b262f (diff)
Sync our copy of the timezone library with IANA release tzcode2017b.
zic no longer mishandles some transitions in January 2038 when it attempts to work around Qt bug 53071. This fixes a bug affecting Pacific/Tongatapu that was introduced in zic 2016e. localtime.c now contains a workaround, useful when loading a file generated by a buggy zic. There are assorted cosmetic changes as well, notably relocation of a bunch of #defines.
Diffstat (limited to 'src/timezone/zic.c')
-rw-r--r--src/timezone/zic.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/timezone/zic.c b/src/timezone/zic.c
index a83cea12ddc..f6beedcab2a 100644
--- a/src/timezone/zic.c
+++ b/src/timezone/zic.c
@@ -2672,6 +2672,9 @@ outzone(const struct zone * zpfirst, ptrdiff_t zonecount)
bool do_extend;
char version;
ptrdiff_t lastatmax = -1;
+ zic_t one = 1;
+ zic_t y2038_boundary = one << 31;
+ zic_t max_year0;
max_abbr_len = 2 + max_format_len + max_abbrvar_len;
max_envvar_len = 2 * max_abbr_len + 5 * 9;
@@ -2781,12 +2784,13 @@ outzone(const struct zone * zpfirst, ptrdiff_t zonecount)
}
/*
- * For the benefit of older systems, generate data from 1900 through 2037.
+ * For the benefit of older systems, generate data from 1900 through 2038.
*/
if (min_year > 1900)
min_year = 1900;
- if (max_year < 2037)
- max_year = 2037;
+ max_year0 = max_year;
+ if (max_year < 2038)
+ max_year = 2038;
for (i = 0; i < zonecount; ++i)
{
/*
@@ -2836,7 +2840,12 @@ outzone(const struct zone * zpfirst, ptrdiff_t zonecount)
year <= rp->r_hiyear &&
yearistype(year, rp->r_yrtype);
if (rp->r_todo)
+ {
rp->r_temp = rpytime(rp, year);
+ rp->r_todo
+ = (rp->r_temp < y2038_boundary
+ || year <= max_year0);
+ }
}
for (;;)
{