Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/time Welcome to 2017c:



details:   https://anonhg.NetBSD.org/src/rev/9851cce329c0
branches:  trunk
changeset: 827346:9851cce329c0
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Oct 24 17:38:17 2017 +0000

description:
Welcome to 2017c:

    zic and the reference runtime now reject multiple leap seconds
    within 28 days of each other, or leap seconds before the Epoch.
    As a result, support for double leap seconds, which was
    obsolescent and undocumented, has been removed.  Double leap
    seconds were an error in the C89 standard; they have never existed
    in civil timekeeping.  (Thanks to Robert Elz and Bradley White for
    noticing glitches in the code that uncovered this problem.)

    zic now warns about use of the obsolescent and undocumented -y
    option, and about use of the obsolescent TYPE field of Rule lines.

    zic now allows unambiguous abbreviations like "Sa" and "Su" for
    weekdays; formerly it rejected them due to a bug.  Conversely, zic
    no longer considers non-prefixes to be abbreviations; for example,
    it no longer accepts "lF" as an abbreviation for "lastFriday".
    Also, zic warns about the undocumented usage with a "last-"
    prefix, e.g., "last-Fri".

    Similarly, zic now accepts the unambiguous abbreviation "L" for
    "Link" in ordinary context and for "Leap" in leap-second context.
    Conversely, zic no longer accepts non-prefixes such as "La" as
    abbreviations for words like "Leap".

    zic no longer accepts leap second lines in ordinary input, or
    ordinary lines in leap second input.  Formerly, zic sometimes
    warned about this undocumented usage and handled it incorrectly.

    The new macro HAVE_TZNAME governs whether the tzname external
    variable is exported, instead of USG_COMPAT.  USG_COMPAT now
    governs only the external variables "timezone" and "daylight".
    This change is needed because the three variables are not in the
    same category: although POSIX requires tzname, it specifies the
    other two variables as optional.  Also, USG_COMPAT is now 1 or 0:
    if not defined, the code attempts to guess it from other macros.

    localtime.c and difftime.c no longer require stdio.h, and .c files
    other than zic.c no longer require sys/wait.h.

    zdump.c no longer assumes snprintf.  (Reported by Jonathan Leffler.)

    Calculation of time_t extrema works around a bug in GCC 4.8.4
    (Reported by Stan Shebs and Joseph Myers.)

    zic.c no longer mistranslates formats of line numbers in non-English
    locales.  (Problem reported by Benno Schulenberg.)

    Several minor changes have been made to the code to make it a
    bit easier to port to MS-Windows and Solaris.  (Thanks to Kees
    Dekker for reporting the problems.)

  Changes to documentation and commentary

    The two new files 'theory.html' and 'calendars' contain the
    contents of the removed file 'Theory'.  The goal is to document
    tzdb theory more accessibly.

    The zic man page now documents abbreviation rules.

    tz-link.htm now covers how to apply tzdata changes to clients.
    (Thanks to Jorge F?bregas for the AIX link.)  It also mentions MySQL.

    The leap-seconds.list URL has been updated to something that is
    more reliable for tzdb.  (Thanks to Tim Parenti and Brian Inglis.)

diffstat:

 lib/libc/time/CONTRIBUTING   |    18 +-
 lib/libc/time/LICENSE        |     9 +-
 lib/libc/time/Makefile       |   268 +++++++---
 lib/libc/time/NEWS           |   178 +++++++-
 lib/libc/time/asctime.c      |    17 +-
 lib/libc/time/calendars      |   173 +++++++
 lib/libc/time/ctime.3        |    46 +-
 lib/libc/time/difftime.c     |     6 +-
 lib/libc/time/localtime.c    |   170 +++---
 lib/libc/time/private.h      |   204 +++++--
 lib/libc/time/strftime.c     |    69 +-
 lib/libc/time/theory.html    |  1034 ++++++++++++++++++++++++++++++++++++++++++
 lib/libc/time/tz-art.htm     |    77 ++-
 lib/libc/time/tz-how-to.html |     9 +-
 lib/libc/time/tz-link.htm    |   193 +++---
 lib/libc/time/tzfile.5       |    87 +-
 lib/libc/time/tzselect.ksh   |    10 +-
 lib/libc/time/version        |     2 +-
 lib/libc/time/zdump.c        |    72 ++-
 lib/libc/time/zic.8          |    34 +-
 lib/libc/time/zic.c          |   137 +++-
 21 files changed, 2264 insertions(+), 549 deletions(-)

diffs (truncated from 4692 to 300 lines):

diff -r 956ffd2b7ed3 -r 9851cce329c0 lib/libc/time/CONTRIBUTING
--- a/lib/libc/time/CONTRIBUTING        Tue Oct 24 17:01:15 2017 +0000
+++ b/lib/libc/time/CONTRIBUTING        Tue Oct 24 17:38:17 2017 +0000
@@ -5,20 +5,26 @@
 warning, the data entries do not cover all of civil time before
 1970, and undoubtedly errors remain in the code and data.  Feel
 free to fill gaps or fix mistakes, and please email improvements
-to tz%iana.org@localhost for use in the future.
+to tz%iana.org@localhost for use in the future.  In your email, please give
+reliable sources that reviewers can check.
+
+-----
+
+Developers can contribute technical changes to the source code and
+data as follows.
 
 To email small changes, please run a POSIX shell command like
 'diff -u old/europe new/europe >myfix.patch', and attach
 myfix.patch to the email.
 
-For more-elaborate changes, please read the Theory file and browse
-the mailing list archives <http://mm.icann.org/pipermail/tz/> for
-examples of patches that tend to work well.  Ideally, additions to
+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.
+justification.  Citations should use https: URLs if available.
 
 Please submit changes against either the latest release in
-<ftp://ftp.iana.org/tz/> or the master branch of the development
+<https://www.iana.org/time-zones> or the master branch of the development
 repository.  If you use Git the following workflow may be helpful:
 
   * Copy the development repository.
diff -r 956ffd2b7ed3 -r 9851cce329c0 lib/libc/time/LICENSE
--- a/lib/libc/time/LICENSE     Tue Oct 24 17:01:15 2017 +0000
+++ b/lib/libc/time/LICENSE     Tue Oct 24 17:38:17 2017 +0000
@@ -1,4 +1,5 @@
-With a few exceptions, all files in the tz code and data (including
-this one) are in the public domain.  The exceptions are date.c,
-newstrftime.3, and strftime.c, which contain material derived from BSD
-and which use the BSD 3-clause license.
+Unless specified below, all files in the tz code and data (including
+this LICENSE file) are in the public domain.
+
+If the files date.c, newstrftime.3, and strftime.c are present, they
+contain material derived from BSD and use the BSD 3-clause license.
diff -r 956ffd2b7ed3 -r 9851cce329c0 lib/libc/time/Makefile
--- a/lib/libc/time/Makefile    Tue Oct 24 17:01:15 2017 +0000
+++ b/lib/libc/time/Makefile    Tue Oct 24 17:38:17 2017 +0000
@@ -49,6 +49,7 @@
 # "Compiled" time zone information is placed in the "TZDIR" directory
 # (and subdirectories).
 # Use an absolute path name for TZDIR unless you're just testing the software.
+# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty.
 
 TZDIR_BASENAME=        zoneinfo
 TZDIR=         $(TOPDIR)/etc/$(TZDIR_BASENAME)
@@ -75,7 +76,7 @@
 # If you want only POSIX time, with time values interpreted as
 # seconds since the epoch (not counting leap seconds), use
 #      REDO=           posix_only
-# below.  If you want want only "right" time, with values interpreted
+# below.  If you want only "right" time, with values interpreted
 # as seconds since the epoch (counting leap seconds), use
 #      REDO=           right_only
 # below.  If you want both sets of data available, with leap seconds not
@@ -92,6 +93,24 @@
 
 REDO=          posix_right
 
+# To install data in text form that has all the information of the binary data,
+# (optionally incorporating leap second information), use
+#      TZDATA_TEXT=    tzdata.zi leapseconds
+# To install text data without leap second information (e.g., because
+# REDO='posix_only'), use
+#      TZDATA_TEXT=    tzdata.zi
+# To avoid installing text data, use
+#      TZDATA_TEXT=
+
+TZDATA_TEXT=   leapseconds tzdata.zi
+
+# For backward-compatibility links for old zone names, use
+#      BACKWARD=       backward pacificnew
+# To omit these links, use
+#      BACKWARD=
+
+BACKWARD=      backward pacificnew
+
 # If you want out-of-scope and often-wrong data from the file 'backzone', use
 #      PACKRATDATA=    backzone
 # To omit this data, use
@@ -99,6 +118,11 @@
 
 PACKRATDATA=
 
+# The name of a locale using the UTF-8 encoding, used during self-tests.
+# The tests are skipped if the name does not appear to work on this system.
+
+UTF8_LOCALE=   en_US.utf8
+
 # Since "." may not be in PATH...
 
 YEARISTYPE=    ./yearistype
@@ -106,78 +130,81 @@
 # Non-default libraries needed to link.
 LDLIBS=
 
-# Add the following to the end of the "CFLAGS=" line as needed.
+# 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
+#  -DEPOCH_OFFSET=N if the 'time' function returns a value N greater
+#      than what POSIX specifies, assuming local time is UT.
+#      For example, N is 252460800 on AmigaOS.
 #  -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r
+#  -DHAVE_DECL_ENVIRON if <unistd.h> declares 'environ'
 #  -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows)
-#  -DHAVE_DOS_FILE_NAMES if file names have drive specifiers etc. (MS-DOS)
-#  -DHAVE_GETTEXT=1 if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris)
-#  -DHAVE_INCOMPATIBLE_CTIME_R=1 if your system's time.h declares
+#  -DHAVE_GENERIC=0 if _Generic does not work
+#  -DHAVE_GETTEXT if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris)
+#  -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares
 #      ctime_r and asctime_r incompatibly with the POSIX standard
 #      (Solaris when _POSIX_PTHREAD_SEMANTICS is not defined).
-#  -DHAVE_INTTYPES_H=1 if you have a pre-C99 compiler with "inttypes.h"
+#  -DHAVE_INTTYPES_H if you have a non-C99 compiler with <inttypes.h>
 #  -DHAVE_LINK=0 if your system lacks a link function
 #  -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
 #  -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
-#      This defaults to 1 if a working localtime_rz seems to be available.
 #      localtime_rz can make zdump significantly faster, but is nonstandard.
 #  -DHAVE_POSIX_DECLS=0 if your system's include files do not declare
 #      functions like 'link' or variables like 'tzname' required by POSIX
-#  -DHAVE_STDINT_H=1 if you have a pre-C99 compiler with "stdint.h"
-#  -DHAVE_STRFTIME_L=1 if <time.h> declares locale_t and strftime_l
-#      This defaults to 0 if _POSIX_VERSION < 200809, 1 otherwise.
+#  -DHAVE_SNPRINTF=0 if your system lacks the snprintf function
+#  -DHAVE_STDBOOL_H if you have a non-C99 compiler with <stdbool.h>
+#  -DHAVE_STDINT_H if you have a non-C99 compiler with <stdint.h>
+#  -DHAVE_STRFTIME_L if <time.h> declares locale_t and strftime_l
 #  -DHAVE_STRDUP=0 if your system lacks the strdup function
 #  -DHAVE_SYMLINK=0 if your system lacks the symlink function
-#  -DHAVE_SYS_STAT_H=0 if your compiler lacks a "sys/stat.h"
-#  -DHAVE_SYS_WAIT_H=0 if your compiler lacks a "sys/wait.h"
+#  -DHAVE_SYS_STAT_H=0 if your compiler lacks a <sys/stat.h>
+#  -DHAVE_SYS_WAIT_H=0 if your compiler lacks a <sys/wait.h>
 #  -DHAVE_TZSET=0 if your system lacks a tzset function
-#  -DHAVE_UNISTD_H=0 if your compiler lacks a "unistd.h" (Microsoft C++ 7?)
-#  -DEPOCH_LOCAL=1 if the 'time' function returns local time not UT
-#  -DEPOCH_OFFSET=N if the 'time' function returns a value N greater
-#      than what POSIX specifies, assuming local time is UT.
-#      For example, N is 252460800 on AmigaOS.
-#  -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU=1
-#      if you do not want run time warnings about formats that may cause
-#      year 2000 grief
-#  -Dssize_t=long on ancient hosts that lack ssize_t
-#  -DTHREAD_SAFE=1 to make localtime.c thread-safe, as POSIX requires;
+#  -DHAVE_UNISTD_H=0 if your compiler lacks a <unistd.h>
+#  -Dlocale_t=XXX if your system uses XXX instead of locale_t
+#  -Dssize_t=long on hosts like MS-Windows that lack ssize_t
+#  -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires;
 #      not needed by the main-program tz code, which is single-threaded.
 #      Append other compiler flags as needed, e.g., -pthread on GNU/Linux.
 #  -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
+#      This is intended for internal use only; it mangles external names.
 #  -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
 #  -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
 #      the default is system-supplied, typically "/usr/lib/locale"
 #  -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
-#  -DUNINIT_TRAP=1 if reading uninitialized storage can cause problems
+#      DST transitions if the time zone files cannot be accessed
+#  -DUNINIT_TRAP if reading uninitialized storage can cause problems
 #      other than simply getting garbage data
 #  -DUSE_LTZ=0 to build zdump with the system time zone library
 #      Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below.
-#  -DNO_ERROR_IN_DST_GAP=1
-#      if you want mktime() not to return an error in the DST gap.
 #  -DZIC_MAX_ABBR_LEN_WO_WARN=3
 #      (or some other number) to set the maximum time zone abbreviation length
 #      that zic will accept without a warning (the default is 6)
 #  $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking
-GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict-aliasing \
-       -Wall -Wextra \
-       -Wbad-function-cast -Wcast-align -Wdate-time \
-       -Wdeclaration-after-statement \
-       -Wdouble-promotion \
-       -Wformat=2 -Winit-self -Wjump-misses-init \
-       -Wlogical-op -Wmissing-prototypes -Wnested-externs \
-       -Wold-style-definition -Woverlength-strings -Wpointer-arith \
-       -Wshadow -Wstrict-prototypes -Wsuggest-attribute=const \
-       -Wsuggest-attribute=format -Wsuggest-attribute=noreturn \
-       -Wsuggest-attribute=pure -Wtrampolines \
-       -Wundef -Wunused -Wwrite-strings \
-       -Wno-address -Wno-format-nonliteral -Wno-sign-compare \
-       -Wno-type-limits -Wno-unused-parameter
-#
-# If you want to use System V compatibility code, add
-#      -DUSG_COMPAT
-# to the end of the "CFLAGS=" line.  This arrange for "timezone" and "daylight"
-# variables to be kept up-to-date by the time conversion functions.  Neither
-# "timezone" nor "daylight" is described in X3J11's work.
+# Select instrumentation via "make GCC_INSTRUMENT='whatever'".
+GCC_INSTRUMENT = \
+  -fsanitize=undefined -fsanitize-address-use-after-scope \
+  -fsanitize-undefined-trap-on-error -fstack-protector
+GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
+  $(GCC_INSTRUMENT) \
+  -Wall -Wextra \
+  -Walloc-size-larger-than=100000 -Warray-bounds=2 \
+  -Wbad-function-cast -Wcast-align -Wdate-time \
+  -Wdeclaration-after-statement -Wdouble-promotion \
+  -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
+  -Winit-self -Wjump-misses-init -Wlogical-op \
+  -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
+  -Wold-style-definition -Woverlength-strings -Wpointer-arith \
+  -Wshadow -Wshift-overflow=2 -Wstrict-prototypes -Wstringop-overflow=5 \
+  -Wsuggest-attribute=const -Wsuggest-attribute=format \
+  -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \
+  -Wtrampolines -Wundef -Wuninitialized -Wunused \
+  -Wvariadic-macros -Wvla -Wwrite-strings \
+  -Wno-address -Wno-format-nonliteral -Wno-sign-compare \
+  -Wno-type-limits -Wno-unused-parameter
 #
 # If your system has a "GMT offset" field in its "struct tm"s
 # (or if you decide to add such a field in your system's "time.h" file),
@@ -190,6 +217,31 @@
 # and define NO_TM_ZONE to suppress any guessing.  These two fields are not
 # required by POSIX, but are widely available on GNU/Linux and BSD systems.
 #
+# The next batch of options control support for external variables
+# exported by tzcode.  In practice these variables are less useful
+# than TM_GMTOFF and TM_ZONE.  However, most of them are standardized.
+# #
+# # To omit or support the external variable "tzname", add one of:
+# #    -DHAVE_TZNAME=0
+# #    -DHAVE_TZNAME=1
+# # to the "CFLAGS=" line.  "tzname" is required by POSIX 1988 and later.
+# # If not defined, the code attempts to guess HAVE_TZNAME from other macros.
+# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause
+# # crashes when combined with some platforms' standard libraries,
+# # presumably due to memory allocation issues.
+# #
+# # To omit or support the external variables "timezone" and "daylight", add
+# #    -DUSG_COMPAT=0
+# #    -DUSG_COMPAT=1
+# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by
+# # Unix Systems Group code and are required by POSIX 2008 (with XSI) and later.
+# # If not defined, the code attempts to guess USG_COMPAT from other macros.
+# #
+# # To support the external variable "altzone", add
+# #    -DALTZONE
+# # to the end of the "CFLAGS=" line; although "altzone" appeared in
+# # System V Release 3.1 it has not been standardized.
+#
 # If you want functions that were inspired by early versions of X3J11's work,
 # add
 #      -DSTD_INSPIRED
@@ -227,11 +279,6 @@
 #      -DALL_STATE
 # to the end of the "CFLAGS=" line.  Storage is obtained by calling malloc.
 #
-# If you want an "altzone" variable (a la System V Release 3.1), add
-#      -DALTZONE
-# to the end of the "CFLAGS=" line.
-# This variable is not described in X3J11's work.
-#
 # NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
 # out by the National Institute of Standards and Technology
 # which claims to test C and Posix conformance.  If you want to pass PCTS, add
@@ -241,8 +288,8 @@
 # If you want strict compliance with XPG4 as of 1994-04-09, add
 #      -DXPG4_1994_04_09
 # to the end of the "CFLAGS=" line.  This causes "strftime" to always return
-# 53 as a week number (rather than 52 or 53) for those days in January that
-# before the first Monday in January when a "%V" format is used and January 1
+# 53 as a week number (rather than 52 or 53) for January days before
+# January's first Monday when a "%V" format is used and January 1
 # falls on a Friday, Saturday, or Sunday.
 
 CFLAGS=
@@ -266,7 +313,7 @@
 
 # How to use zic to install tz binary files.
 
-ZIC_INSTALL=   $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) $(LEAPSECONDS)
+ZIC_INSTALL=   $(ZIC) -d $(DESTDIR)$(TZDIR) $(LEAPSECONDS)
 
 # The name of a Posix-compliant 'awk' on your system.
 AWK=           awk
@@ -290,6 +337,7 @@
 # The name, arguments and environment of a program to validate your web pages.
 # See <http://openjade.sourceforge.net/doc/> for a validator, and
 # <https://validator.w3.org/source/> for a validation library.



Home | Main Index | Thread Index | Old Index