Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/time Update to 2018f:



details:   https://anonhg.NetBSD.org/src/rev/8818c2d694f2
branches:  trunk
changeset: 445259:8818c2d694f2
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Oct 19 23:05:35 2018 +0000

description:
Update to 2018f:

  Changes to code

    zic now always generates TZif files where time type 0 is used for
    timestamps before the first transition.  This simplifies the
    reading of TZif files and should not affect behavior of existing
    TZif readers because the same set of time types is used; only
    their internal indexes may have changed.  This affects only the
    legacy zones EST5EDT, CST6CDT, MST7MDT, PST8PDT, CET, MET, and
    EET, which previously used nonzero types for these timestamps.

    Because of the type 0 change, zic no longer outputs a dummy
    transition at time -2**59 (before the Big Bang), as clients should
    no longer need this to handle historical timestamps correctly.
    This reverts a change introduced in 2013d and shrinks most TZif
    files by a few bytes.

    zic now supports negative time-of-day in Rule and Leap lines, e.g.,
    "Rule X min max - Apr lastSun -6:00 1:00 -" means the transition
    occurs at 18:00 on the Saturday before the last Sunday in April.
    This behavior was documented in 2018a but the code did not
    entirely match the documentation.

    localtime.c no longer requires at least one time type in TZif
    files that lack transitions or have a POSIX-style TZ string.  This
    future-proofs the code against possible future extensions to the
    format that would allow TZif files with POSIX-style TZ strings and
    without transitions or time types.

    A read-access subscript error in localtime.c has been fixed.
    It could occur only in TZif files with timecnt == 0, something that
    does not happen in practice now but could happen in future versions.

    localtime.c no longer ignores TZif POSIX-style TZ strings that
    specify only standard time.  Instead, these TZ strings now
    override the default time type for timestamps after the last
    transition (or for all time stamps if there are no transitions),
    just as DST strings specifying DST have always done.

    leapseconds.awk now outputs "#updated" and "#expires" comments,
    and supports leap seconds at the ends of months other than June
    and December.  (Inspired by suggestions from Chris Woodbury.)

  Changes to documentation

    New restrictions: A Rule name must start with a character that
    is neither an ASCII digit nor "-" nor "+", and an unquoted name
    should not use characters in the set "!$%&'()*,/:;<=>?@[\]^`{|}~".
    The latter restriction makes room for future extensions (a
    possibility noted by Tom Lane).

    tzfile.5 now documents what time types apply before the first and
    after the last transition, if any.

    Documentation now uses the spelling "timezone" for a TZ setting
    that determines timestamp history, and "time zone" for a
    geographic region currently sharing the same standard time.

    The name "TZif" is now used for the tz binary data format.

    tz-link.htm now mentions the A0 TimeZone Migration utilities.
    (Thanks to Aldrin Martoq for the link.)

diffstat:

 lib/libc/time/CONTRIBUTING   |   13 +-
 lib/libc/time/Makefile       |  326 ++++++++++++++++++++++++++----------------
 lib/libc/time/NEWS           |  321 +++++++++++++++++++++++++++++------------
 lib/libc/time/README         |   16 +-
 lib/libc/time/ctime.3        |   18 +-
 lib/libc/time/difftime.c     |    6 +-
 lib/libc/time/localtime.c    |   95 ++++++++----
 lib/libc/time/private.h      |    4 +-
 lib/libc/time/strftime.3     |   10 +-
 lib/libc/time/strftime.c     |    7 +-
 lib/libc/time/theory.html    |  203 ++++++++++++++++----------
 lib/libc/time/tz-art.html    |   10 +-
 lib/libc/time/tz-how-to.html |    5 +-
 lib/libc/time/tz-link.html   |  114 ++++++++------
 lib/libc/time/tzfile.5       |   44 +++--
 lib/libc/time/tzselect.8     |   14 +-
 lib/libc/time/tzselect.ksh   |   26 +-
 lib/libc/time/tzset.3        |   24 +-
 lib/libc/time/version        |    2 +-
 lib/libc/time/zdump.8        |   37 ++--
 lib/libc/time/zdump.c        |    8 +-
 lib/libc/time/zic.8          |  118 +++++++++------
 22 files changed, 883 insertions(+), 538 deletions(-)

diffs (truncated from 3578 to 300 lines):

diff -r e958ff16367d -r 8818c2d694f2 lib/libc/time/CONTRIBUTING
--- a/lib/libc/time/CONTRIBUTING        Fri Oct 19 22:51:13 2018 +0000
+++ b/lib/libc/time/CONTRIBUTING        Fri Oct 19 23:05:35 2018 +0000
@@ -17,11 +17,14 @@
 'diff -u old/europe new/europe >myfix.patch', and attach
 myfix.patch to the email.
 
-For more-elaborate changes, please read the theory.html file and browse
-the mailing list archives <https://mm.icann.org/pipermail/tz/> for
-examples of patches that tend to work well.  Additions to
-data should contain commentary citing reliable sources as
-justification.  Citations should use https: URLs if available.
+For more-elaborate or possibly-controversial changes,
+such as renaming, adding or removing zones, please read
+<https://www.iana.org/time-zones/repository/theory.html> or the file
+theory.html.  It is also good to browse the mailing list archives
+<https://mm.icann.org/pipermail/tz/> for examples of patches that tend
+to work well.  Additions to data should contain commentary citing
+reliable sources as justification.  Citations should use https: URLs
+if available.
 
 Please submit changes against either the latest release in
 <https://www.iana.org/time-zones> or the master branch of the development
diff -r e958ff16367d -r 8818c2d694f2 lib/libc/time/Makefile
--- a/lib/libc/time/Makefile    Fri Oct 19 22:51:13 2018 +0000
+++ b/lib/libc/time/Makefile    Fri Oct 19 23:05:35 2018 +0000
@@ -1,3 +1,5 @@
+# Make and install tzdb code and data.
+
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -19,9 +21,9 @@
 #      DATAFORM=       rearguard
 DATAFORM=              main
 
-# Change the line below for your time zone (after finding the zone you want in
-# the time zone files, or adding it to a time zone file).
-# Alternatively, if you discover you've got the wrong time zone, you can just
+# Change the line below for your timezone (after finding the one you want in
+# one of the $(TDATA) source files, or adding it to a source file).
+# Alternatively, if you discover you've got the wrong timezone, you can just
 #      zic -l rightzone
 # to correct things.
 # Use the command
@@ -31,14 +33,14 @@
 LOCALTIME=     GMT
 
 # If you want something other than Eastern United States time as a template
-# for handling POSIX-style time zone environment variables,
-# change the line below (after finding the zone you want in the
-# time zone files, or adding it to a time zone file).
+# for handling POSIX-style timezone environment variables,
+# change the line below (after finding the timezone you want in the
+# one of the $(TDATA) source files, or adding it to a source file).
 # When a POSIX-style environment variable is handled, the rules in the
 # template file are used to determine "spring forward" and "fall back" days and
 # times; the environment variable itself specifies UT offsets of standard and
 # daylight saving time.
-# Alternatively, if you discover you've got the wrong time zone, you can just
+# Alternatively, if you discover you've got the wrong timezone, you can just
 #      zic -p rightzone
 # to correct things.
 # Use the command
@@ -75,7 +77,7 @@
 # TOPDIR should be empty or an absolute name unless you're just testing.
 TOPDIR =
 
-# The default local time zone is taken from the file TZDEFAULT.
+# The default local timezone is taken from the file TZDEFAULT.
 TZDEFAULT = $(TOPDIR)/etc/localtime
 
 # The subdirectory containing installed program and data files, and
@@ -84,7 +86,7 @@
 USRDIR = usr
 USRSHAREDIR = $(USRDIR)/share
 
-# "Compiled" time zone information is placed in the "TZDIR" directory
+# "Compiled" timezone information is placed in the "TZDIR" directory
 # (and subdirectories).
 # TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty.
 TZDIR_BASENAME=        zoneinfo
@@ -106,9 +108,13 @@
 LIBDIR = $(TOPDIR)/$(USRDIR)/lib
 
 
-# Types to try, as an alternative to time_t.  int64_t should be first.
-TIME_T_ALTERNATIVES = int64_t int32_t uint32_t uint64_t
+# Types to try, as an alternative to time_t.
+TIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL)
+TIME_T_ALTERNATIVES_HEAD = int64_t
+TIME_T_ALTERNATIVES_TAIL = int32_t uint32_t uint64_t
 
+# What kind of TZif data files to generate.
+# (TZif is the binary time zone data format that zic generates.)
 # If you want only POSIX time, with time values interpreted as
 # seconds since the epoch (not counting leap seconds), use
 #      REDO=           posix_only
@@ -129,7 +135,7 @@
 
 REDO=          posix_right
 
-# To install data in text form that has all the information of the binary data,
+# To install data in text form that has all the information of the TZif data,
 # (optionally incorporating leap second information), use
 #      TZDATA_TEXT=    tzdata.zi leapseconds
 # To install text data without leap second information (e.g., because
@@ -171,7 +177,6 @@
 
 # Add the following to the end of the "CFLAGS=" line as needed to override
 # defaults specified in the source code.  "-DFOO" is equivalent to "-DFOO=1".
-#  -DBIG_BANG=-9999999LL if the Big Bang occurred at time -9999999 (see zic.c)
 #  -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime
 #      formats that generate only the last two digits of year numbers
 #  -DEPOCH_LOCAL if the 'time' function returns local time not UT
@@ -295,7 +300,7 @@
 # "tzsetwall", "offtime", "timelocal", "timegm", "timeoff",
 # "posix2time", and "time2posix" to be added to the time conversion library.
 # "tzsetwall" is like "tzset" except that it arranges for local wall clock
-# time (rather than the time specified in the TZ environment variable)
+# time (rather than the timezone specified in the TZ environment variable)
 # to be used.
 # "offtime" is like "gmtime" except that it accepts a second (long) argument
 # that gives an offset to add to the time_t when converting it.
@@ -318,7 +323,7 @@
 # "posix2time_z" and "time2posix_z" are added as well.
 # The functions ending in "_z" (or "_rz") are like their unsuffixed
 # (or suffixed-by-"_r") counterparts, except with an extra first
-# argument of opaque type timezone_t that specifies the time zone.
+# argument of opaque type timezone_t that specifies the timezone.
 # "tzalloc" allocates a timezone_t value, and "tzfree" frees it.
 #
 # If you want to allocate state structures in localtime, add
@@ -357,11 +362,14 @@
 
 ZFLAGS=
 
-# How to use zic to install tz binary files.
+# How to use zic to install TZif files.
 
 ZIC_INSTALL=   $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS)
 
 # The name of a Posix-compliant 'awk' on your system.
+# Older 'mawk' versions, such as the 'mawk' in Ubuntu 16.04, might dump core;
+# on Ubuntu you can work around this with
+#      AWK=            gawk
 AWK=           awk
 
 # The full path name of a Posix-compliant shell, preferably one that supports
@@ -410,10 +418,16 @@
 SAFE_CHARSET=  $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
 SAFE_CHAR=     '[]'$(SAFE_CHARSET)'-]'
 
+# These characters are Latin-1, and so are likely to be displayable
+# even in editors with limited character sets.
+UNUSUAL_OK_LATIN_1 = «°±»½¾�
+# This IPA symbol is represented in Unicode as the composition of
+# U+0075 and U+032F, and U+032F is not considered alphabetic by some
+# grep implementations that do not grok composition.
+UNUSUAL_OK_IPA = u̯
 # Non-ASCII non-letters that OK_CHAR allows, as these characters are
-# useful in commentary.  XEmacs 21.5.34 displays them correctly,
-# presumably because they are Latin-1.
-UNUSUAL_OK_CHARSET= °±½¾�
+# useful in commentary.
+UNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1)$(UNUSUAL_OK_IPA)
 
 # OK_CHAR matches any character allowed in the distributed files.
 # This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and
@@ -492,11 +506,14 @@
                        ziguard.awk zishrink.awk
 MISC=          $(AWK_SCRIPTS) zoneinfo2tdf.pl
 TZS_YEAR=      2050
+TZS_CUTOFF_FLAG=       -c $(TZS_YEAR)
 TZS=           to$(TZS_YEAR).tzs
 TZS_NEW=       to$(TZS_YEAR)new.tzs
 TZS_DEPS=      $(PRIMARY_YDATA) asctime.c localtime.c \
                        private.h tzfile.h zdump.c zic.c
-ENCHILADA=     $(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) $(TZS) tzdata.zi
+# EIGHT_YARDS is just a yard short of the whole ENCHILADA.
+EIGHT_YARDS = $(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) tzdata.zi
+ENCHILADA = $(EIGHT_YARDS) $(TZS)
 
 # Consult these files when deciding whether to rebuild the 'version' file.
 # This list is not the same as the output of 'git ls-files', since
@@ -560,14 +577,21 @@
                printf '%s\n' "$$V" >$@.out
                mv $@.out $@
 
-# These files can be tailored by setting BACKWARD, PACKRATDATA, etc.
+# These files can be tailored by setting BACKWARD and PACKRATDATA.
 vanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS)
                $(AWK) -v DATAFORM=`expr $@ : '\(.*\).zi'` -f ziguard.awk \
                  $(TDATA) $(PACKRATDATA) >$@.out
                mv $@.out $@
-tzdata.zi:     $(DATAFORM).zi version
+# This file has a version comment that attempts to capture any tailoring
+# via BACKWARD, DATAFORM, PACKRATDATA, and REDO.
+tzdata.zi:     $(DATAFORM).zi version zishrink.awk
                version=`sed 1q version` && \
-                 LC_ALL=C $(AWK) -v version="$$version" -f zishrink.awk \
+                 LC_ALL=C $(AWK) \
+                   -v dataform='$(DATAFORM)' \
+                   -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \
+                   -v redo='$(REDO)' \
+                   -v version="$$version" \
+                   -f zishrink.awk \
                    $(DATAFORM).zi >$@.out
                mv $@.out $@
 
@@ -605,14 +629,16 @@
  YEARISTYPE='$(YEARISTYPE)' \
  ZIC='$(ZIC)'
 
-# 'make install_data' installs one set of tz binary files.
-install_data:  zic leapseconds yearistype tzdata.zi
+INSTALL_DATA_DEPS = zic leapseconds yearistype tzdata.zi
+
+# 'make install_data' installs one set of TZif files.
+install_data: $(INSTALL_DATA_DEPS)
                $(ZIC_INSTALL) tzdata.zi
 
-posix_only:
+posix_only: $(INSTALL_DATA_DEPS)
                $(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data
 
-right_only:
+right_only: $(INSTALL_DATA_DEPS)
                $(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \
                        install_data
 
@@ -639,7 +665,7 @@
 
 # This obsolescent rule is present for backwards compatibility with
 # tz releases 2014g through 2015g.  It should go away eventually.
-posix_packrat:
+posix_packrat: $(INSTALL_DATA_DEPS)
                $(MAKE) $(INSTALLARGS) PACKRATDATA=backzone posix_only
 
 zones:         $(REDO)
@@ -650,29 +676,33 @@
 # Rule used only by submakes invoked by the $(TZS_NEW) rule.
 # It is separate so that GNU 'make -j' can run instances in parallel.
 $(ZDS): zdump
-               ./zdump -i -c $(TZS_YEAR) '$(wd)/'$$(expr $@ : '\(.*\).zd') >$@
+               ./zdump -i $(TZS_CUTOFF_FLAG) '$(wd)/'$$(expr $@ : '\(.*\).zd') \
+                 >$@
 
-$(TZS_NEW):    tzdata.zi zdump zic
-               rm -fr tzs.dir
-               mkdir tzs.dir
-               $(zic) -d tzs.dir tzdata.zi
+TZS_NEW_DEPS = tzdata.zi zdump zic
+$(TZS_NEW): $(TZS_NEW_DEPS)
+               rm -fr tzs$(TZS_YEAR).dir
+               mkdir tzs$(TZS_YEAR).dir
+               $(zic) -d tzs$(TZS_YEAR).dir tzdata.zi
                $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \
                   tzdata.zi | LC_ALL=C sort >$@.out
                wd=`pwd` && \
-               set x `$(AWK) '/^Z/{print "tzs.dir/" $$2 ".zd"}' tzdata.zi \
+               x=`$(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \
+                               tzdata.zi \
                        | LC_ALL=C sort -t . -k 2,2` && \
+               set x $$x && \
                shift && \
                ZDS=$$* && \
-               $(MAKE) wd="$$wd" TZS_YEAR=$(TZS_YEAR) ZDS="$$ZDS" $$ZDS && \
-               sed 's,^TZ=".*tzs\.dir/,TZ=",' $$ZDS >>$@.out
-               rm -fr tzs.dir
+               $(MAKE) wd="$$wd" TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \
+                 ZDS="$$ZDS" $$ZDS && \
+               sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out
+               rm -fr tzs$(TZS_YEAR).dir
                mv $@.out $@
 
-# If $(TZS) does not already exist (e.g., old-format tarballs), create it.
-# If it exists but 'make check_tzs' fails, a maintainer should inspect the
+# If $(TZS) exists but 'make check_tzs' fails, a maintainer should inspect the
 # failed output and fix the inconsistency, perhaps by running 'make force_tzs'.
 $(TZS):
-               $(MAKE) force_tzs
+               touch $@
 
 force_tzs:     $(TZS_NEW)
                cp $(TZS_NEW) $(TZS)
@@ -711,18 +741,21 @@
                        $(MISC) $(SOURCES) $(WEB_PAGES) \
                        CONTRIBUTING LICENSE README \
                        version tzdata.zi && \
-               ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_CHARSET='$(OK_CHAR)'*$$' \
+               ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \
                        Makefile && \
                ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \
                        leapseconds yearistype.sh zone.tab && \
                ! grep -Env $(OK_LINE) $(ENCHILADA); \
        }
+       touch $@
 
 check_white_space: $(ENCHILADA)



Home | Main Index | Thread Index | Old Index