Module Name: src Committed By: christos Date: Thu Oct 20 17:41:34 UTC 2016
Modified Files: src/lib/libc/time: Makefile NEWS Theory private.h strftime.c tz-link.htm zdump.c Added Files: src/lib/libc/time: version Removed Files: src/lib/libc/time: version.h Log Message: welcome to 2016h To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/lib/libc/time/Makefile cvs rdiff -u -r1.17 -r1.18 src/lib/libc/time/NEWS cvs rdiff -u -r1.21 -r1.22 src/lib/libc/time/Theory cvs rdiff -u -r1.46 -r1.47 src/lib/libc/time/private.h cvs rdiff -u -r1.37 -r1.38 src/lib/libc/time/strftime.c cvs rdiff -u -r1.27 -r1.28 src/lib/libc/time/tz-link.htm cvs rdiff -u -r0 -r1.1 src/lib/libc/time/version cvs rdiff -u -r1.2 -r0 src/lib/libc/time/version.h cvs rdiff -u -r1.44 -r1.45 src/lib/libc/time/zdump.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/time/Makefile diff -u src/lib/libc/time/Makefile:1.34 src/lib/libc/time/Makefile:1.35 --- src/lib/libc/time/Makefile:1.34 Fri Oct 7 11:29:42 2016 +++ src/lib/libc/time/Makefile Thu Oct 20 13:41:34 2016 @@ -5,7 +5,7 @@ PACKAGE= tzcode # Version number for the distribution, overridden in the 'tarballs' rule below. -VERSION= 2016g +VERSION= unknown # Email address for bug reports. BUGEMAIL= t...@iana.org @@ -101,7 +101,6 @@ PACKRATDATA= YEARISTYPE= ./yearistype # Non-default libraries needed to link. -# Add -lintl if you want to use 'gettext' on Solaris. LDLIBS= # Add the following to the end of the "CFLAGS=" line as needed. @@ -109,9 +108,10 @@ LDLIBS= # -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r # -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 (GNU, Linux, Solaris); also see LDLIBS +# -DHAVE_GETTEXT=1 if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris) # -DHAVE_INCOMPATIBLE_CTIME_R=1 if your system's time.h declares -# ctime_r and asctime_r incompatibly with the POSIX standard (Solaris 8). +# 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_LINK=0 if your system lacks a link function # -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function @@ -357,14 +357,14 @@ HEADERS= tzfile.h private.h NONLIBSRCS= zic.c zdump.c NEWUCBSRCS= date.c strftime.c SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \ - tzselect.ksh version workman.sh + tzselect.ksh workman.sh MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \ tzfile.5 tzselect.8 zic.8 zdump.8 MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \ time2posix.3.txt \ tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \ date.1.txt -COMMON= CONTRIBUTING LICENSE Makefile NEWS README Theory +COMMON= CONTRIBUTING LICENSE Makefile NEWS README Theory version WEB_PAGES= tz-art.htm tz-how-to.html tz-link.htm DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) PRIMARY_YDATA= africa antarctica asia australasia \ @@ -435,16 +435,20 @@ INSTALL: ALL install date.1 cp -f date.1 $(DESTDIR)$(MANDIR)/man1/. version: $(VERSION_DEPS) - { V=$$(git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ - --abbrev=7 --dirty) || \ + { (type git) >/dev/null 2>&1 && \ + V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ + --abbrev=7 --dirty` || \ V=$(VERSION); } && \ - printf '%s\n' "$$V" >$@ + printf '%s\n' "$$V" >$@.out + mv $@.out $@ version.h: version - (echo 'static char const PKGVERSION[]="($(PACKAGE)) ";' && \ - printf 'static char const TZVERSION[]="%s";\n' \ - "$$(cat version)" && \ - echo 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";') >$@ + VERSION=`cat version` && printf '%s\n' \ + 'static char const PKGVERSION[]="($(PACKAGE)) ";' \ + "static char const TZVERSION[]=\"$$VERSION\";" \ + 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \ + >$@.out + mv $@.out $@ zdump: $(TZDOBJS) $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS) @@ -457,7 +461,8 @@ yearistype: yearistype.sh chmod +x yearistype leapseconds: $(LEAP_DEPS) - $(AWK) -f leapseconds.awk leap-seconds.list >$@ + $(AWK) -f leapseconds.awk leap-seconds.list >$@.out + mv $@.out $@ # Arguments to pass to submakes of install_data. # They can be overridden by later submake arguments. @@ -515,12 +520,14 @@ $(TZS_NEW): $(TDATA) zdump zic $(zic) -d tzs.dir $(TDATA) $(AWK) '/^Link/{print $$1 "\t" $$2 "\t" $$3}' \ $(TDATA) | LC_ALL=C sort >$@.out - zones=$$($(AWK) -v wd="$$(pwd)" \ + wd=`pwd` && \ + zones=`$(AWK) -v wd="$$wd" \ '/^Zone/{print wd "/tzs.dir/" $$2}' $(TDATA) \ - | LC_ALL=C sort) && \ + | LC_ALL=C sort` && \ ./zdump -i -c $(TZS_YEAR) $$zones >>$@.out - sed 's,^TZ=".*tzs\.dir/,TZ=",' $@.out >$@ + sed 's,^TZ=".*tzs\.dir/,TZ=",' $@.out >$@.sed.out rm -fr tzs.dir $@.out + mv $@.sed.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 @@ -539,15 +546,16 @@ date: $(DATEOBJS) $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS) tzselect: tzselect.ksh version - sed \ + VERSION=`cat version` && sed \ -e 's|#!/bin/bash|#!$(KSHELL)|g' \ -e 's|AWK=[^}]*|AWK=$(AWK)|g' \ -e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \ -e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \ -e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \ - -e 's|\(TZVERSION\)=.*|\1='"$$(cat version)"'|' \ - <$@.ksh >$@ - chmod +x $@ + -e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \ + <$@.ksh >$@.out + chmod +x $@.out + mv $@.out $@ check: check_character_set check_white_space check_links check_sorted \ check_tables check_tzs check_web @@ -555,14 +563,16 @@ check: check_character_set check_white_ check_character_set: $(ENCHILADA) LC_ALL=en_US.utf8 && export LC_ALL && \ sharp='#' && \ - ! grep -Env $(SAFE_LINE) Makefile $(MANS) date.1 $(MANTXTS) \ - $(MISC) $(SOURCES) $(WEB_PAGES) && \ + ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \ + $(MISC) $(SOURCES) $(WEB_PAGES) \ + CONTRIBUTING LICENSE Makefile README version && \ ! grep -Env $(SAFE_SHARP_LINE) $(TDATA) backzone \ leapseconds yearistype.sh zone.tab && \ ! grep -Env $(OK_LINE) $(ENCHILADA) check_white_space: $(ENCHILADA) - ! grep -En ' '$(TAB_CHAR)"|$$(printf '[\f\r\v]')" $(ENCHILADA) + patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \ + ! grep -En "$$pat" $(ENCHILADA) ! grep -n '[[:space:]]$$' $(ENCHILADA) CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } @@ -620,7 +630,8 @@ zdump.8.txt: zdump.8 zic.8.txt: zic.8 $(MANTXTS): workman.sh - LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@ + LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out + mv $@.out $@ # Set the time stamps to those of the git repository, if available, # and if the files have not changed since then. @@ -631,7 +642,8 @@ $(MANTXTS): workman.sh # to be the maximum of the files it depends on. set-timestamps.out: $(ENCHILADA) rm -f $@ - if files=`git ls-files $(ENCHILADA)` && \ + if (type git) >/dev/null 2>&1 && \ + files=`git ls-files $(ENCHILADA)` && \ touch -md @1 test.out; then \ rm -f test.out && \ for file in $$files; do \ @@ -648,8 +660,8 @@ set-timestamps.out: $(ENCHILADA) touch -cmr `ls -t $$file workman.sh | sed 1q` $$file.txt || \ exit; \ done - touch -cmr $$(ls -t $(TZS_DEPS) | sed 1q) $(TZS) - touch -cmr $$(ls -t $(VERSION_DEPS) | sed 1q) version + touch -cmr `ls -t $(TZS_DEPS) | sed 1q` $(TZS) + touch -cmr `ls -t $(VERSION_DEPS) | sed 1q` version touch $@ # The zics below ensure that each data file can stand on its own. @@ -673,11 +685,12 @@ check_time_t_alternatives: else \ quiet_option=''; \ fi && \ + wd=`pwd` && \ zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \ for type in $(TIME_T_ALTERNATIVES); do \ mkdir -p time_t.dir/$$type && \ $(MAKE) clean_misc && \ - $(MAKE) TOPDIR=$$(pwd)/time_t.dir/$$type \ + $(MAKE) TOPDIR="$$wd/time_t.dir/$$type" \ CFLAGS='$(CFLAGS) -Dtime_tz='"'$$type'" \ REDO='$(REDO)' \ install && \ @@ -706,28 +719,39 @@ tarballs signatures: version tarballs_version: tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz \ tzdb-$(VERSION).tar.lz +tarballs traditional_tarballs signatures traditional_signatures: version + VERSION=`cat version` && \ + $(MAKE) VERSION="$$VERSION" $@_version + +tarballs_version: traditional_tarballs_version tzdb-$(VERSION).tar.lz +traditional_tarballs_version: \ + tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz +signatures_version: traditional_signatures_version tzdb-$(VERSION).tar.lz.asc +traditional_signatures_version: \ + tzcode$(VERSION).tar.gz.asc tzdata$(VERSION).tar.gz.asc \ tzcode$(VERSION).tar.gz: set-timestamps.out LC_ALL=C && export LC_ALL && \ tar $(TARFLAGS) -cf - \ $(COMMON) $(DOCS) $(SOURCES) | \ ${TOOL_GZIP} $(GZIPFLAGS) > $@ + ${TOOL_GZIP} $(GZIPFLAGS) >$@.out + mv $@.out $@ tzdata$(VERSION).tar.gz: set-timestamps.out LC_ALL=C && export LC_ALL && \ tar $(TARFLAGS) -cf - $(COMMON) $(DATA) $(MISC) | \ - ${TOOL_GZIP} $(GZIPFLAGS) > $@ + ${TOOL_GZIP} $(GZIPFLAGS) > $@.out + mv $@.out $@ tzdb-$(VERSION).tar.lz: set-timestamps.out rm -fr tzdb-$(VERSION) mkdir tzdb-$(VERSION) ln $(ENCHILADA) tzdb-$(VERSION) - touch -cmr $$(ls -t tzdb-$(VERSION)/* | sed 1q) tzdb-$(VERSION) + touch -cmr `ls -t tzdb-$(VERSION)/* | sed 1q` tzdb-$(VERSION) LC_ALL=C && export LC_ALL && \ - tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 > $@ - -signatures_version: tzcode$(VERSION).tar.gz.asc tzdata$(VERSION).tar.gz.asc \ - tzdb-$(VERSION).tar.lz.asc + tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out + mv $@.out $@ tzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz gpg --armor --detach-sign $? Index: src/lib/libc/time/NEWS diff -u src/lib/libc/time/NEWS:1.17 src/lib/libc/time/NEWS:1.18 --- src/lib/libc/time/NEWS:1.17 Fri Oct 7 11:29:42 2016 +++ src/lib/libc/time/NEWS Thu Oct 20 13:41:34 2016 @@ -1,5 +1,62 @@ News for the tz database +Release 2016h - 2016-10-19 23:17:57 -0700 + + Changes to future time stamps + + Asia/Gaza and Asia/Hebron end DST on 2016-10-29 at 01:00, not + 2016-10-21 at 00:00. (Thanks to Sharef Mustafa.) Predict that + future fall transitions will be on the last Saturday of October + at 01:00, which is consistent with predicted spring transitions + on the last Saturday of March. (Thanks to Tim Parenti.) + + Changes to past time stamps + + In Turkey, transitions in 1986-1990 were at 01:00 standard time + not at 02:00, and the spring 1994 transition was on March 20, not + March 27. (Thanks to Kıvanç Yazan.) + + Changes to past and future time zone abbreviations + + Asia/Colombo now uses numeric time zone abbreviations like "+0530" + instead of alphabetic ones like "IST" and "LKT". Various + English-language sources use "IST", "LKT" and "SLST", with no + working consensus. (Usage of "SLST" mentioned by Sadika + Sumanapala.) + + Changes to code + + zic no longer mishandles relativizing file names when creating + symbolic links like /etc/localtime, when these symbolic links + are outside the usual directory hierarchy. This fixes a bug + introduced in 2016g. (Problem reported by Andreas Stieger.) + + Changes to build procedure + + New rules 'traditional_tarballs' and 'traditional_signatures' for + building just the traditional-format distribution. (Requested by + Deborah Goldsmith.) + + The file 'version' is now put into the tzdata tarball too. + (Requested by Howard Hinnant.) + + Changes to documentation and commentary + + The 'Theory' file now has a section on interface stability. + (Requested by Paul Koning.) It also mentions features like + tm_zone and localtime_rz that have long been supported by the + reference code. + + tz-link.htm has improved coverage of time zone boundaries suitable + for geolocation. (Thanks to heads-ups from Evan Siroky and Matt + Johnson.) + + The US commentary now mentions Allen and the "day of two noons". + + The Fiji commentary mentions the government's 2016-10-03 press + release. (Thanks to Raymond Kumar.) + + Release 2016g - 2016-09-13 08:56:38 -0700 Changes to future time stamps Index: src/lib/libc/time/Theory diff -u src/lib/libc/time/Theory:1.21 src/lib/libc/time/Theory:1.22 --- src/lib/libc/time/Theory:1.21 Fri Oct 7 11:29:42 2016 +++ src/lib/libc/time/Theory Thu Oct 20 13:41:34 2016 @@ -445,6 +445,10 @@ POSIX has the following properties and l rules change (as in the United States in 1987), all programs that do time conversion must be recompiled to ensure proper results. +* The TZ environment variable is process-global, which makes it hard + to write efficient, thread-safe applications that need access + to multiple time zones. + * In POSIX, there's no tamper-proof way for a process to learn the system's best idea of local wall clock. (This is important for applications that an administrator wants used only at certain times - @@ -454,6 +458,11 @@ POSIX has the following properties and l daylight saving time shifts - as might be required to limit phone calls to off-peak hours.) +* POSIX provides no convenient and efficient way to determine the UT + offset and time zone abbreviation of arbitrary time stamps, + particularly for time zone settings that do not fit into the + POSIX model. + * POSIX requires that systems ignore leap seconds. * The tz code attempts to support all the time_t implementations @@ -494,20 +503,23 @@ These are the extensions that have been "new" programs (a la POSIX) and "old" programs (as zone names and offsets). -* To handle places where more than two time zone abbreviations are used, - the functions "localtime" and "gmtime" set tzname[tmp->tm_isdst] - (where "tmp" is the value the function returns) to the time zone - abbreviation to be used. This differs from POSIX, where the elements - of tzname are only changed as a result of calls to tzset. +* The code supports platforms with a UT offset member in struct tm, + e.g., tm_gmtoff. + +* The code supports platforms with a time zone abbreviation member in + struct tm, e.g., tm_zone. * Since the "TZ" environment variable can now be used to control time conversion, the "daylight" and "timezone" variables are no longer needed. (These variables are defined and set by "tzset"; however, their values will not be used by "localtime.") -* The "localtime" function has been set up to deliver correct results - for near-minimum or near-maximum time_t values. (A comment in the - source code tells how to get compatibly wrong results). +* Functions tzalloc, tzfree, localtime_rz, and mktime_z for + more-efficient thread-safe applications that need to use + multiple time zones. The tzalloc and tzfree functions + allocate and free objects of type timezone_t, and localtime_rz + and mktime_z are like localtime_r and mktime with an extra + timezone_t argument. The functions were inspired by NetBSD. * A function "tzsetwall" has been added to arrange for the system's best approximation to local wall clock time to be delivered by @@ -526,14 +538,15 @@ These are the extensions that have been Points of interest to folks with other systems: -* This package is already part of many POSIX-compliant hosts, - including BSD, HP, Linux, Network Appliance, SCO, SGI, and Sun. +* Code compatible with this package is already part of many platforms, + including GNU/Linux, Android, the BSDs, Chromium OS, Cygwin, AIX, iOS, + BlackBery 10, macOS, Microsoft Windows, OpenVMS, and Solaris. On such hosts, the primary use of this package is to update obsolete time zone rule tables. To do this, you may need to compile the time zone compiler 'zic' supplied with this package instead of using the system 'zic', - since the format of zic's input changed slightly in late 1994, - and many vendors still do not support the new input format. + since the format of zic's input is occasionally extended, + and a platform may still be shipping an older zic. * The UNIX Version 7 "timezone" function is not present in this package; it's impossible to reliably map timezone's arguments (a "minutes west @@ -551,6 +564,8 @@ Points of interest to folks with other s * In SVR2, time conversion fails for near-minimum or near-maximum time_t values when doing conversions for places that don't use UT. This package takes care to do these conversions correctly. + A comment in the source code tells how to get compatibly wrong + results. The functions that are conditionally compiled if STD_INSPIRED is defined should, at this point, be looked on primarily as food for thought. They are @@ -568,6 +583,35 @@ more powerful time conversion functions better. +----- Interface stability ----- + +The tz code and data supply the following interfaces: + + * A set of zone names as per "Names of time zone rules" above. + + * Library functions described in "Time and date functions" above. + + * The programs tzselect, zdump, and zic, documented in their man pages. + + * The format of zic input files, documented in the zic man page. + + * The format of zic output files, documented in the tzfile man page. + + * The format of zone table files, documented in zone1970.tab. + + * The format of the country code file, documented in iso3166.tab. + +When these interfaces are changed, an effort is made to preserve +backward compatibility. For example, tz data files typically do not +rely on recently-added zic features, so that users can run older zic +versions to process newer data files. + +Interfaces not listed above are less stable. For example, users +should not rely on particular UT offsets or abbreviations for time +stamps, as data entries are often based on guesswork and these guesses +may be corrected or improved. + + ----- Calendrical issues ----- Calendrical issues are a bit out of scope for a time zone database, Index: src/lib/libc/time/private.h diff -u src/lib/libc/time/private.h:1.46 src/lib/libc/time/private.h:1.47 --- src/lib/libc/time/private.h:1.46 Fri Oct 7 11:29:42 2016 +++ src/lib/libc/time/private.h Thu Oct 20 13:41:34 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: private.h,v 1.46 2016/10/07 15:29:42 christos Exp $ */ +/* $NetBSD: private.h,v 1.47 2016/10/20 17:41:34 christos Exp $ */ #ifndef PRIVATE_H #define PRIVATE_H @@ -90,9 +90,9 @@ /* Enable tm_gmtoff and tm_zone on GNUish systems. */ #define _GNU_SOURCE 1 -/* Fix asctime_r on Solaris 10. */ +/* Fix asctime_r on Solaris 11. */ #define _POSIX_PTHREAD_SEMANTICS 1 -/* Enable strtoimax on Solaris 10. */ +/* Enable strtoimax on pre-C99 Solaris 11. */ #define __EXTENSIONS__ 1 /* @@ -177,15 +177,15 @@ /* ** Define HAVE_STDINT_H's default value here, rather than at the -** start, since __GLIBC__'s value depends on previously-included -** files. -** (glibc 2.1 and later have stdint.h, even with pre-C99 compilers.) +** start, since __GLIBC__ and INTMAX_MAX's values depend on +** previously-included files. glibc 2.1 and Solaris 10 and later have +** stdint.h, even with pre-C99 compilers. */ #ifndef HAVE_STDINT_H #define HAVE_STDINT_H \ (199901 <= __STDC_VERSION__ \ || 2 < __GLIBC__ + (1 <= __GLIBC_MINOR__) \ - || __CYGWIN__) + || __CYGWIN__ || INTMAX_MAX) #endif /* !defined HAVE_STDINT_H */ #if HAVE_STDINT_H Index: src/lib/libc/time/strftime.c diff -u src/lib/libc/time/strftime.c:1.37 src/lib/libc/time/strftime.c:1.38 --- src/lib/libc/time/strftime.c:1.37 Fri Oct 7 11:29:42 2016 +++ src/lib/libc/time/strftime.c Thu Oct 20 13:41:34 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: strftime.c,v 1.37 2016/10/07 15:29:42 christos Exp $ */ +/* $NetBSD: strftime.c,v 1.38 2016/10/20 17:41:34 christos Exp $ */ /* Convert a broken-down time stamp to a string. */ @@ -35,7 +35,7 @@ static char elsieid[] = "@(#)strftime.c 7.64"; static char elsieid[] = "@(#)strftime.c 8.3"; #else -__RCSID("$NetBSD: strftime.c,v 1.37 2016/10/07 15:29:42 christos Exp $"); +__RCSID("$NetBSD: strftime.c,v 1.38 2016/10/20 17:41:34 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -494,15 +494,16 @@ label: */ continue; case 'z': +#if defined TM_GMTOFF || defined USG_COMPAT || defined ALTZONE { long diff; char const * sign; if (t->tm_isdst < 0) continue; -#ifdef TM_GMTOFF +# ifdef TM_GMTOFF diff = (int)t->TM_GMTOFF; -#else /* !defined TM_GMTOFF */ +# else /* ** C99 says that the UT offset must ** be computed by looking only at @@ -522,20 +523,20 @@ label: ** determinable, so output nothing if the ** appropriate variables are not available. */ -#ifndef STD_INSPIRED +# ifndef STD_INSPIRED if (t->tm_isdst == 0) -#ifdef USG_COMPAT +# ifdef USG_COMPAT diff = -timezone; -#else /* !defined USG_COMPAT */ +# else continue; -#endif /* !defined USG_COMPAT */ +# endif else -#ifdef ALTZONE +# ifdef ALTZONE diff = -altzone; -#else /* !defined ALTZONE */ +# else continue; -#endif /* !defined ALTZONE */ -#else /* defined STD_INSPIRED */ +# endif +# else { struct tm tmp; time_t lct, gct; @@ -563,8 +564,8 @@ label: /* LINTED difference will fit int */ diff = (intmax_t)gct - (intmax_t)lct; } -#endif /* defined STD_INSPIRED */ -#endif /* !defined TM_GMTOFF */ +# endif +# endif if (diff < 0) { sign = "-"; diff = -diff; @@ -576,6 +577,7 @@ label: _DIAGASSERT(__type_fit(int, diff)); pt = _conv((int)diff, "%04d", pt, ptlim); } +#endif continue; #if 0 case '+': Index: src/lib/libc/time/tz-link.htm diff -u src/lib/libc/time/tz-link.htm:1.27 src/lib/libc/time/tz-link.htm:1.28 --- src/lib/libc/time/tz-link.htm:1.27 Fri Oct 7 11:29:42 2016 +++ src/lib/libc/time/tz-link.htm Thu Oct 20 13:41:34 2016 @@ -10,7 +10,7 @@ content="Sources for time zone and daylight saving time data"> <meta name="DC.Creator" content="Eggert, Paul"> <meta name="DC.Contributor" content="Olson, Arthur David"> -<meta name="DC.Date" content="2016-09-09"> +<meta name="DC.Date" content="2016-10-19"> <meta name="DC.Description" content="Sources of information about time zones and daylight saving time"> <meta name="DC.Identifier" @@ -27,7 +27,7 @@ histories and planned futures are often is a summary of attempts to organize and record relevant data in this area. </p> -<h2>The <code><abbr title="time zone">tz</abbr></code> database</h2> +<h2 id="tzdb">The <code><abbr title="time zone">tz</abbr></code> database</h2> <p> The <a href="https://en.wikipedia.org/wiki/Public_domain">public-domain</a> time zone database contains code and data @@ -140,7 +140,7 @@ The releases can also be obtained from t <a href="http://www.iana.org/time-zones">Time Zone Database website</a> of the <a href="http://www.iana.org">Internet Assigned Numbers Authority (IANA)</a>. -An <a href="https://github.com/eggert/tz">unofficial development +A <a href="https://github.com/eggert/tz">development repository</a> of the code and data is available in <a href="https://git-scm.com">Git</a> form from <a href="https://github.com">GitHub</a>; be careful, as this @@ -152,7 +152,7 @@ The code lets you compile the <code><abb machine-readable binary files, one for each location. It also lets you read a <code><abbr>tz</abbr></code> binary file and interpret time stamps for that location.</p> -<h2>Changes to the <code><abbr>tz</abbr></code> database</h2> +<h2 id="changes">Changes to the <code><abbr>tz</abbr></code> database</h2> <p> The <code><abbr>tz</abbr></code> code and data are by no means authoritative. If you find errors, please @@ -194,7 +194,7 @@ For further information about updates, p <a href="https://tools.ietf.org/html/rfc6557">Procedures for Maintaining the Time Zone Database</a> (Internet <abbr title="Request For Comments">RFC</abbr> 6557).</p> -<h2>Commentary on the <code><abbr>tz</abbr></code> database</h2> +<h2 id="commentary">Commentary on the <code><abbr>tz</abbr></code> database</h2> <ul> <li>The article <a href="https://en.wikipedia.org/wiki/Tz_database">tz database</a> is @@ -212,7 +212,8 @@ href="https://blog.jonudell.net/2009/10/ literary appreciation of the Olson/Zoneinfo/tz database</a> comments on the database's style.</li> </ul> -<h2>Web sites using recent versions of the <code><abbr>tz</abbr></code> database</h2> +<h2 id="web">Web sites using recent versions of the +<code><abbr>tz</abbr></code> database</h2> <p> These are listed roughly in ascending order of complexity and fanciness. </p> @@ -242,16 +243,20 @@ calculates the current time difference b also contains data about time zone boundaries; it supports queries via place names and shows location maps.</li> </ul> -<h2>Network protocols for <code><abbr>tz</abbr></code> data</h2> +<h2 id="protocols">Network protocols for <code><abbr>tz</abbr></code> data</h2> <ul> <li>The <a href="https://www.ietf.org">Internet Engineering Task Force</a>'s <a href="https://datatracker.ietf.org/wg/tzdist/charter/">Time Zone Data Distribution Service (tzdist) working group</a> defined <a href="https://tools.ietf.org/html/rfc7808">TZDIST</a> (Internet <abbr>RFC</abbr> 7808), a time zone data distribution service, -along with a <a href="https://tools.ietf.org/html/rfc7809">calendar access -protocol for transferring time zone data by reference</a> -(Internet <abbr>RFC</abbr> 7809).</li> +along with <a href="https://tools.ietf.org/html/rfc7809">CalDAV</a> +(Internet <abbr>RFC</abbr> 7809), a calendar access protocol for +transferring time zone data by reference. The draft <a name="TZDIST-Geolocate" +href="https://tools.ietf.org/html/draft-murchison-tzdist-geolocate-00">TZDIST +Geolocate Extension</a> lets a client determine its time zone region +from its geographic location using a <a +href="https://tools.ietf.org/html/rfc5870">'geo' URI</a>.</li> <li>The <a href="https://tools.ietf.org/html/rfc5545"> Internet Calendaring and Scheduling Core Object Specification (iCalendar)</a> (Internet <abbr>RFC</abbr> 5445) @@ -267,7 +272,7 @@ title="Extensible Markup Language">XML</ uses <a href="http://www.json.org"><abbr title="JavaScript Object Notation">JSON</abbr></a> format.</li> </ul> -<h2>Other <code><abbr>tz</abbr></code> compilers</h2> +<h2 id="compilers">Other <code><abbr>tz</abbr></code> compilers</h2> <ul> <li><a href="https://sourceforge.net/projects/vzic/">Vzic</a> is a <a href="https://en.wikipedia.org/wiki/C_%28programming_language%29">C</a> @@ -298,13 +303,13 @@ Database Parser</a> is a runtime library. It is freely available under the <a href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International Public License</a>.</li> -<li><a href="http://site.icu-project.org">International Components for +<li><a name="ICU" href="http://site.icu-project.org">International Components for Unicode (<abbr>ICU</abbr>)</a> contains C/C++ and <a href="https://en.wikipedia.org/wiki/Java_%28programming_language%29">Java</a> libraries for internationalization that has a compiler from <code><abbr>tz</abbr></code> source and from <abbr title="Common Locale Data Repository">CLDR</abbr> data -(mentioned below) +(mentioned <a href="#CLDR">below</a>) into an <abbr>ICU</abbr>-specific format. <abbr>ICU</abbr> is freely available under a <abbr>BSD</abbr>-style license.</li> @@ -340,7 +345,7 @@ available under the <a href="https://www.gnu.org/copyleft/lesser.html"><abbr>GNU</abbr> Lesser General Public License (<abbr title="Lesser General Public License">LGPL</abbr>)</a>.</li> -<li><abbr>ICU</abbr> (mentioned above) contains compilers and +<li><abbr>ICU</abbr> (mentioned <a href="#ICU">above</a>) contains compilers and Java-based libraries.</li> </ul> <li><a href="http://nodatime.org">Noda Time – Date and @@ -384,13 +389,13 @@ library that compiles <code><abbr>tz</ab zone repository whose format is either proprietary or an <abbr>XML</abbr>-encoded representation.</li> -<li><a href="http://tcl.tk">Tcl</a> +<li><a name="Tcl" href="http://tcl.tk">Tcl</a> contains a developer-oriented parser that compiles <code><abbr>tz</abbr></code> source into text files, along with a runtime that can read those files. Tcl is freely available under a <abbr>BSD</abbr>-style license.</li> </ul> -<h2>Other <code><abbr>tz</abbr></code> binary file readers</h2> +<h2 id="binary">Other <code><abbr>tz</abbr></code> binary file readers</h2> <ul> <li>The <a href="https://www.gnu.org/software/libc/"><abbr>GNU</abbr> C @@ -419,7 +424,7 @@ It is freely available under the <abbr>L <li><a href="https://github.com/bigeasy/timezone">Timezone</a> is a JavaScript library that supports date arithmetic that is time zone aware. It is freely available under the <abbr>MIT</abbr> license.</li> -<li>Tcl, mentioned above, also contains a +<li>Tcl, mentioned <a href="#Tcl">above</a>, also contains a <code><abbr>tz</abbr></code> binary file reader.</li> <li><a href="http://search.cpan.org/perldoc?DateTime::TimeZone::Tzfile"> DateTime::TimeZone::Tzfile</a> @@ -439,7 +444,7 @@ package contains <a href="https://www.ha parses and uses <code><abbr>tz</abbr></code> binary data. It is freely available under a <abbr>BSD</abbr>-style license.</li> </ul> -<h2>Other <code><abbr>tz</abbr></code>-based time zone software</h2> +<h2 id="software">Other <code><abbr>tz</abbr></code>-based time zone software</h2> <ul> <li><a href="https://foxclocks.org">FoxClocks</a> is an extension for <a href="https://www.google.com/chrome/">Google @@ -462,11 +467,11 @@ clock (intclock)</a> is a clock that dis under the <abbr>GPL</abbr>.</li> <li>Microsoft Windows 8.1 and later has <code><abbr>tz</abbr></code> data and <abbr>CLDR</abbr> -data (mentioned below) used by +data (mentioned <a href="#CLDR">below</a>) used by <a href="https://en.wikipedia.org/wiki/Windows_Runtime">Windows Runtime</a> classes such as <a href="https://msdn.microsoft.com/en-us/library/windows/apps/windows.globalization.datetimeformatting.datetimeformatter.aspx"><code>DateTimeFormatter</code></a>. -<a +<a name="System.TimeZoneInfo" href="https://blogs.msdn.microsoft.com/bclteam/2007/06/07/exploring-windows-time-zones-with-system-timezoneinfo-josh-free/">Exploring Windows Time Zones with <code>System.TimeZoneInfo</code></a> describes the older, proprietary method of Microsoft Windows 2000 and later, @@ -496,7 +501,7 @@ an <abbr>OS X</abbr> program. Its develo <a href="http://veladg.com/tzoffer.html">offer free licenses</a> to <code><abbr>tz</abbr></code> contributors.</li> </ul> -<h2>Other time zone databases</h2> +<h2 id="other-dbs">Other time zone databases</h2> <ul> <li><a href="http://www.astro.com/atlas">Time-zone Atlas</a> is Astrodienst's Web version of Shanks and Pottenger's @@ -513,7 +518,8 @@ guessed many <abbr>UT</abbr> offsets and sources and do not indicate which entries are guesswork.</li> <li><a href="https://en.wikipedia.org/wiki/HP-UX">HP-UX</a> has a database in its own <code>tztab</code>(4) format.</li> -<li>Microsoft Windows has proprietary data mentioned above.</li> +<li>Microsoft Windows has proprietary data mentioned +<a href="#System.TimeZoneInfo">above</a>.</li> <li><a href="http://www.worldtimeserver.com">World Time Server</a> is another time zone database.</li> <li><a href="http://tycho.usno.navy.mil/tzones.html">World Time Zones</a> @@ -525,7 +531,7 @@ Schedules Information Manual</a> of the International Air Transport Association gives current time zone rules for airports served by commercial aviation.</li> </ul> -<h2>Maps</h2> +<h2 id="maps">Maps</h2> <ul> <li>The <a href="https://www.cia.gov/index.html">United States Central Intelligence Agency (<abbr @@ -552,20 +558,74 @@ much is time wrong around the world?</a> mean solar and standard time, highlighting areas such as western China where the two differ greatly. It's a bit out of date, unfortunately.</li> </ul> -<h2>Time zone boundaries</h2> -<ul> +<h2 id="boundaries">Time zone boundaries</h2> +<p>Geographical boundaries between time zone regions are available +from several <a href="https://en.wikipedia.org/wiki/Geolocation">geolocation</a> +services and other sources.</p> +<ul> +<li>Databases of time zone boundaries include: +<ul> +<li><a href="https://github.com/evansiroky/timezone-boundary-builder">Timezone +Boundary Builder</a> extracts +<a href="http://www.openstreetmap.org">Open Street Map</a> data to build +boundaries of <code><abbr>tz</abbr></code> regions. +Its code is freely available under the <abbr>MIT</abbr> license, and +its data entries are freely available under the +<a href="http://opendatacommons.org/licenses/odbl/">Open Data Commons +Open Database License</a>. The maps' borders appear to be quite accurate.</li> <li><a href="http://efele.net/maps/tz/"><abbr>TZ</abbr> timezones maps</a> contains <a href="https://en.wikipedia.org/wiki/Shapefile">shapefiles</a> of -sets of <code><abbr>tz</abbr></code> regions.</li> +sets of <code><abbr>tz</abbr></code> regions. This includes +<a href="http://efele.net/maps/tz/world/">tz_world</a>, a shapefile +for all the world's regions</li> +<li><a +href="https://github.com/straup/whereonearth-timezone">Whereonearth-timezone</a> +is in <a href="http://geojson.org">GeoJSON</a> form, and combines the +the tz_world shapefiles with the GeoPlanet dataset.</li> +</ul></li> +<li>Programmatic interfaces that map geographical coordinates via tz_world to +<code><abbr>tz</abbr></code> regions include: +<ul> +<li><a href="https://github.com/mj1856/GeoTimeZone">GeoTimeZone</a> is +written in <a +href="https://en.wikipedia.org/wiki/C_Sharp_(programming_language)">C#</a> +and is freely available under the <abbr>MIT</abbr> license.</li> <li>The <a href="https://github.com/bradfitz/latlong">latlong package</a> -maps geographical coordinates to a <code><abbr>tz</abbr></code> region. -It is written in Go and is freely available under the Apache License.</li> +is written in Go and is freely available under the Apache License.</li> +<li><a href="https://github.com/drtimcooper/LatLongToTimezone">LatLongToTimezone</a>, +in both Java and +<a href="https://en.wikipedia.org/wiki/Swift_(programming_language)">Swift</a> +form, is freely available under the MIT license.</li> +<li>The <a +href="https://github.com/MrMinimal64/timezonefinder">timezonefinder</a> +library for Python is freely available under the MIT license. +<li>The <a +href="https://github.com/gunyarakun/timezone_finder">timezone_finder</a> +library for Ruby is freely available under the MIT license.</li> +<li>The <a href="https://www.npmjs.com/package/tz-lookup">tz-lookup module</a> +for <a href="https://nodejs.org/en/">Node.js</a> is in the public domain.</li> <li><a href="https://derickrethans.nl/what-time-is-it.html">What Time is It Here?</a> applies <a href="https://www.mongodb.com">MongoDB</a> geospatial query operators to shapefiles' data.</li> +</ul></li> +<li>Free access via a network API, if you a key, is provided by +the <a href="http://www.geonames.org/export/web-services.html#timezone">GeoNames Timezone web service</a>, +the <a href="https://developers.google.com/maps/documentation/timezone/intro">Google Maps Time Zone API</a>, and +the <a href="https://timezonedb.com">Time Zone Database & API</a>. +Commercial network API access is provided +by <a href="https://askgeo.com">AskGeo</a> +and <a href="https://www.geogarage.com/blog/news-1/post/geogarage-time-zone-api-31">GeoGarage</a>. +Also, an <a +href="http://mm.icann.org/pipermail/tz/2016-October/024309.html">experimental +server</a> is available for the TZDIST Geolocate Extension mentioned +<a href="#TZDIST-Geolocate">above</a>.</li> +<li>"<a +href="http://stackoverflow.com/questions/16086962/how-to-get-a-time-zone-from-a-location-using-latitude-and-longitude-coordinates/16086964">How +to get a time zone from a location using latitude and longitude +coordinates?</a>" discusses other geolocation possibilities.</li> <li><a href="http://statoids.com/statoids.html">Administrative -Divisions of Countries ("Statoids")</a> contains lists of +Divisions of Countries ("Statoids")</a> lists political subdivision data related to time zones.</li> <li><a href="http://home.kpn.nl/vanadovv/time/Multizones.html">Time zone boundaries for multizone countries</a> summarizes legal @@ -589,7 +649,7 @@ for land and territorial waters only). A clocks any time after entering a new time zone; midnight changes are common.</li> </ul> -<h2>Civil time concepts and history</h2> +<h2 id="civil">Civil time concepts and history</h2> <ul> <li><a href="http://physics.nist.gov/time">A Walk through Time</a> @@ -609,7 +669,7 @@ time zone boundary.</li> <li><a href="http://statoids.com/tconcept.html">Basic Time Zone Concepts</a> discusses terminological issues behind time zones.</li> </ul> -<h2>National histories of legal time</h2> +<h2 id="national">National histories of legal time</h2> <dl> <dt>Australia</dt> <dd>The Parliamentary Library has commissioned a <a @@ -650,7 +710,7 @@ Congress has published a <a href="http://www.diputados.gob.mx/bibliot/publica/inveyana/polisoc/horver/index.htm" hreflang="es">history of Mexican local time (in Spanish)</a>.</dd> <dt>Malaysia</dt> -<dd>See Singapore below.</dd> +<dd>See Singapore <a href="#Singapore">below</a>.</dd> <dt>Netherlands</dt> <dd><a href="http://www.staff.science.uu.nl/~gent0113/wettijd/wettijd.htm" hreflang="nl">Legal time in the Netherlands (in Dutch)</a> @@ -662,7 +722,7 @@ Daylight Saving</a>. The privately-maint href="http://astrologyschool.com/nztime.html">History of New Zealand time</a> has more details.</dd> <dt>Singapore</dt> -<dd><a +<dd><a name="Singapore" href="http://www.math.nus.edu.sg/aslaksen/teaching/timezone.html">Why is Singapore in the "Wrong" Time Zone?</a> details the history of legal time in Singapore and Malaysia.</dd> @@ -679,7 +739,7 @@ of Summer time dates</a>.</dd> href="https://www.transportation.gov/regulations/recent-time-zone-proceedings">Recent Time Zone Proceedings</a> lists changes to time zone boundaries.</dd> </dl> -<h2>Precision timekeeping</h2> +<h2 id="precision">Precision timekeeping</h2> <ul> <li><a href="http://literature.agilent.com/litweb/pdf/5965-7984E.pdf">The @@ -752,9 +812,9 @@ might be redefined without Leap Seconds</a> gives pointers on this contentious issue.</li> </ul> -<h2>Time notation</h2> +<h2 id="notation">Time notation</h2> <ul> -<li>The <a href="http://cldr.unicode.org">Unicode Common Locale Data +<li>The <a name="CLDR" href="http://cldr.unicode.org">Unicode Common Locale Data Repository (<abbr>CLDR</abbr>) Project</a> has localizations for time zone names, abbreviations, identifiers, and formats. For example, it contains French translations for "Eastern European Summer Time", @@ -777,9 +837,8 @@ interchange – Representation of da <a href="https://www.w3.org/TR/xmlschema-2/#dateTime"><abbr>XML</abbr> Schema: Datatypes – dateTime</a> specifies a format inspired by <abbr>ISO</abbr> 8601 that is in common use in <abbr>XML</abbr> data.</li> -<li> -<a href="https://tools.ietf.org/html/rfc5322">Internet -Message Format</a> (Internet <abbr>RFC</abbr> 5322) §3.3 +<li><a href="https://tools.ietf.org/html/rfc5322#section-3.3">§3.3 of +Internet Message Format</a> (Internet <abbr>RFC</abbr> 5322) specifies the time notation used in email and <a href="https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol"><abbr>HTTP</abbr></a> headers.</li> @@ -826,7 +885,7 @@ any future changes to the rules. One sho local time is nine hours ahead of <abbr>UTC</abbr> and the time zone is called "<abbr>GMT</abbr>".</li> </ul> -<h2>See also</h2> +<h2 id="see-also">See also</h2> <ul> <li><a href="tz-art.htm">Time and the Arts</a></li> </ul> Index: src/lib/libc/time/zdump.c diff -u src/lib/libc/time/zdump.c:1.44 src/lib/libc/time/zdump.c:1.45 --- src/lib/libc/time/zdump.c:1.44 Fri Oct 7 11:29:42 2016 +++ src/lib/libc/time/zdump.c Thu Oct 20 13:41:34 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: zdump.c,v 1.44 2016/10/07 15:29:42 christos Exp $ */ +/* $NetBSD: zdump.c,v 1.45 2016/10/20 17:41:34 christos Exp $ */ /* ** This file is in the public domain, so clarified as of ** 2009-05-17 by Arthur David Olson. @@ -6,7 +6,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: zdump.c,v 1.44 2016/10/07 15:29:42 christos Exp $"); +__RCSID("$NetBSD: zdump.c,v 1.45 2016/10/20 17:41:34 christos Exp $"); #endif /* !defined lint */ /* @@ -51,7 +51,7 @@ __RCSID("$NetBSD: zdump.c,v 1.44 2016/10 # define HAVE_STDINT_H \ (199901 <= __STDC_VERSION__ \ || 2 < __GLIBC__ + (1 <= __GLIBC_MINOR__) \ - || __CYGWIN__) + || __CYGWIN__ || INTMAX_MAX) #endif #if HAVE_STDINT_H # include "stdint.h" Added files: Index: src/lib/libc/time/version diff -u /dev/null src/lib/libc/time/version:1.1 --- /dev/null Thu Oct 20 13:41:34 2016 +++ src/lib/libc/time/version Thu Oct 20 13:41:34 2016 @@ -0,0 +1 @@ +2016h