Commit acb897b8 authored by Tom Lane's avatar Tom Lane

Sync our copy of the timezone library with IANA release tzcode2019a.

This corrects a small bug in zic that caused it to output an incorrect
year-2440 transition in the Africa/Casablanca zone.

More interestingly, zic has grown a "-r" option that limits the range of
zone transitions that it will put into the output files.  That might be
useful to people who don't like the weird GMT offsets that tzdb likes
to use for very old dates.  It appears that for dates before the cutoff
time specified with -r, zic will use the zone's standard-time offset
as of the cutoff time.  So for example one might do

	make install ZIC_OPTIONS='-r @-1893456000'

to cause all dates before 1910-01-01 to be treated as though 1910
standard time prevailed indefinitely far back.  (Don't blame me for
the unfriendly way of specifying the cutoff time --- it's seconds
since or before the Unix epoch.  You can use extract(epoch ...)
to calculate it.)

As usual, back-patch to all supported branches.
parent d312de3f
...@@ -28,6 +28,9 @@ TZDATAFILES = $(srcdir)/data/tzdata.zi ...@@ -28,6 +28,9 @@ TZDATAFILES = $(srcdir)/data/tzdata.zi
# for POSIX-style timezone specs # for POSIX-style timezone specs
POSIXRULES = US/Eastern POSIXRULES = US/Eastern
# any custom options you might want to pass to zic while installing data files
ZIC_OPTIONS =
# use system timezone data? # use system timezone data?
ifneq (,$(with_system_tzdata)) ifneq (,$(with_system_tzdata))
override CPPFLAGS += '-DSYSTEMTZDIR="$(with_system_tzdata)"' override CPPFLAGS += '-DSYSTEMTZDIR="$(with_system_tzdata)"'
...@@ -52,7 +55,7 @@ zic: $(ZICOBJS) | submake-libpgport ...@@ -52,7 +55,7 @@ zic: $(ZICOBJS) | submake-libpgport
install: all installdirs install: all installdirs
ifeq (,$(with_system_tzdata)) ifeq (,$(with_system_tzdata))
$(ZIC) -d '$(DESTDIR)$(datadir)/timezone' -p '$(POSIXRULES)' $(TZDATAFILES) $(ZIC) -d '$(DESTDIR)$(datadir)/timezone' -p '$(POSIXRULES)' $(ZIC_OPTIONS) $(TZDATAFILES)
endif endif
$(MAKE) -C tznames $@ $(MAKE) -C tznames $@
......
...@@ -55,7 +55,7 @@ match properly on the old version. ...@@ -55,7 +55,7 @@ match properly on the old version.
Time Zone code Time Zone code
============== ==============
The code in this directory is currently synced with tzcode release 2018g. The code in this directory is currently synced with tzcode release 2019a.
There are many cosmetic (and not so cosmetic) differences from the There are many cosmetic (and not so cosmetic) differences from the
original tzcode library, but diffs in the upstream version should usually original tzcode library, but diffs in the upstream version should usually
be propagated to our version. Here are some notes about that. be propagated to our version. Here are some notes about that.
...@@ -111,8 +111,10 @@ to first run the tzcode source files through a sed filter like this: ...@@ -111,8 +111,10 @@ to first run the tzcode source files through a sed filter like this:
-e 's/^([ \t]*)\*\*$/\1 */' \ -e 's/^([ \t]*)\*\*$/\1 */' \
-e 's|^\*/| */|' \ -e 's|^\*/| */|' \
-e 's/\bregister[ \t]//g' \ -e 's/\bregister[ \t]//g' \
-e 's/\bATTRIBUTE_PURE[ \t]//g' \
-e 's/int_fast32_t/int32/g' \ -e 's/int_fast32_t/int32/g' \
-e 's/int_fast64_t/int64/g' \ -e 's/int_fast64_t/int64/g' \
-e 's/intmax_t/int64/g' \
-e 's/INT32_MIN/PG_INT32_MIN/g' \ -e 's/INT32_MIN/PG_INT32_MIN/g' \
-e 's/INT32_MAX/PG_INT32_MAX/g' \ -e 's/INT32_MAX/PG_INT32_MAX/g' \
-e 's/struct[ \t]+tm\b/struct pg_tm/g' \ -e 's/struct[ \t]+tm\b/struct pg_tm/g' \
......
...@@ -44,6 +44,14 @@ ...@@ -44,6 +44,14 @@
/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */ /* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
#define is_digit(c) ((unsigned)(c) - '0' <= 9) #define is_digit(c) ((unsigned)(c) - '0' <= 9)
/* PG doesn't currently rely on <inttypes.h>, so work around strtoimax() */
#undef strtoimax
#ifdef HAVE_STRTOLL
#define strtoimax strtoll
#else
#define strtoimax strtol
#endif
/* /*
* Finally, some convenience items. * Finally, some convenience items.
......
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
#define TZDEFAULT "/etc/localtime" #define TZDEFAULT "/etc/localtime"
#define TZDEFRULES "posixrules" #define TZDEFRULES "posixrules"
/* See Internet RFC 8536 for more details about the following format. */
/* /*
* Each file begins with. . . * Each file begins with. . .
*/ */
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment