Module Name:    src
Committed By:   christos
Date:           Sat Jan 31 18:55:17 UTC 2015

Modified Files:
        src/lib/libc/time: Makefile NEWS localtime.c tz-art.htm tz-link.htm
            tzselect.ksh

Log Message:
merge tzcode2015a:

tzalloc now scrubs time zone abbreviations compatibly with the way
that tzset always has, by replacing invalid bytes with '_' and by
shortening too-long abbreviations.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/lib/libc/time/Makefile
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/time/NEWS src/lib/libc/time/tz-art.htm
cvs rdiff -u -r1.92 -r1.93 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/time/tz-link.htm
cvs rdiff -u -r1.12 -r1.13 src/lib/libc/time/tzselect.ksh

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.25 src/lib/libc/time/Makefile:1.26
--- src/lib/libc/time/Makefile:1.25	Mon Nov 17 20:58:59 2014
+++ src/lib/libc/time/Makefile	Sat Jan 31 13:55:17 2015
@@ -5,7 +5,7 @@
 PACKAGE=	tzcode
 
 # Version numbers of the code and data distributions.
-VERSION=	2014j
+VERSION=	2015a
 
 # Email address for bug reports.
 BUGEMAIL=	t...@iana.org
@@ -360,7 +360,7 @@ TABDATA=	iso3166.tab leapseconds $(ZONET
 LEAP_DEPS=	leapseconds.awk leap-seconds.list
 DATA=		$(YDATA) $(NDATA) backzone $(TABDATA) \
 			leap-seconds.list yearistype.sh
-AWK_SCRIPTS=	checktab.awk leapseconds.awk
+AWK_SCRIPTS=	checklinks.awk checktab.awk leapseconds.awk
 MISC=		$(AWK_SCRIPTS) zoneinfo2tdf.pl
 ENCHILADA=	$(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC)
 
@@ -469,7 +469,7 @@ tzselect:	tzselect.ksh
 			<$? >$@
 		chmod +x $@
 
-check:		check_character_set check_white_space check_sorted \
+check:		check_character_set check_white_space check_links check_sorted \
 		  check_tables check_web
 
 check_character_set: $(ENCHILADA)
@@ -485,9 +485,9 @@ check_character_set: $(ENCHILADA)
 		! grep -Env $(VALID_LINE) $(ENCHILADA)
 
 check_white_space: $(ENCHILADA)
-		! grep -n ' '$(TAB_CHAR) $(ENCHILADA)
-		! grep -n '[[:space:]]$$' $(ENCHILADA)
-		! grep -n "$$(printf '[\f\r\v]\n')" $(ENCHILADA)
+		! grep -En ' '$(TAB_CHAR)"|$$(printf '[\f\r\v]')" $(ENCHILADA)
+		! grep -n '[[:space:]]$$' \
+			$$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
 
 CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
 
@@ -501,6 +501,9 @@ check_sorted: backward backzone iso3166.
 		$(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \
 		  LC_ALL=C sort -cu
 
+check_links:	checklinks.awk $(TDATA)
+		$(AWK) -f checklinks.awk $(TDATA)
+
 check_tables:	checktab.awk $(PRIMARY_YDATA) $(ZONETABLES)
 		for tab in $(ZONETABLES); do \
 		  $(AWK) -f checktab.awk -v zone_table=$$tab $(PRIMARY_YDATA) \
@@ -663,7 +666,8 @@ zic.o:		private.h tzfile.h version.h
 .KEEP_STATE:
 
 .PHONY: ALL INSTALL all
-.PHONY: check check_character_set check_public check_sorted check_tables
+.PHONY: check check_character_set check_links
+.PHONY: check_public check_sorted check_tables
 .PHONY: check_time_t_alternatives check_web check_white_space clean clean_misc
 .PHONY: install maintainer-clean names posix_packrat posix_only posix_right
 .PHONY: public right_only right_posix signatures tarballs typecheck

Index: src/lib/libc/time/NEWS
diff -u src/lib/libc/time/NEWS:1.8 src/lib/libc/time/NEWS:1.9
--- src/lib/libc/time/NEWS:1.8	Mon Nov 17 20:58:59 2014
+++ src/lib/libc/time/NEWS	Sat Jan 31 13:55:17 2015
@@ -1,5 +1,57 @@
 News for the tz database
 
+Release 2015a - 2015-01-29 22:35:20 -0800
+
+  Changes affecting future time stamps
+
+    The Mexican state of Quintana Roo, represented by America/Cancun,
+    will shift from Central Time with DST to Eastern Time without DST
+    on 2015-02-01 at 02:00.  (Thanks to Steffen Thorsen and Gwillim Law.)
+
+    Chile will not change clocks in April or thereafter; its new standard time
+    will be its old daylight saving time.  This affects America/Santiago,
+    Pacific/Easter, and Antarctica/Palmer.  (Thanks to Juan Correa.)
+
+    New leap second 2015-06-30 23:59:60 UTC as per IERS Bulletin C 49.
+    (Thanks to Tim Parenti.)
+
+  Changes affecting past time stamps
+
+    Iceland observed DST in 1919 and 1921, and its 1939 fallback
+    transition was Oct. 29, not Nov. 29.  Remove incorrect data from
+    Shanks about time in Iceland between 1837 and 1908.
+
+    Some more zones have been turned into links, when they differed
+    from existing zones only for older time stamps.  As usual,
+    these changes affect UTC offsets in pre-1970 time stamps only.
+    Their old contents have been moved to the 'backzone' file.
+    The affected zones are: Asia/Aden, Asia/Bahrain, Asia/Kuwait,
+    and Asia/Muscat.
+
+  Changes affecting code
+
+    tzalloc now scrubs time zone abbreviations compatibly with the way
+    that tzset always has, by replacing invalid bytes with '_' and by
+    shortening too-long abbreviations.
+
+    tzselect ports to POSIX awk implementations, no longer mishandles
+    POSIX TZ settings when GNU awk is used, and reports POSIX TZ
+    settings to the user.  (Thanks to Stefan Kuhn.)
+
+  Changes affecting build procedure
+
+    'make check' now checks for links to links in the data.
+    One such link (for Africa/Asmera) has been fixed.
+    (Thanks to Stephen Colebourne for pointing out the problem.)
+
+  Changes affecting commentary
+
+    The leapseconds file commentary now mentions the expiration date.
+    (Problem reported by Martin Burnicki.)
+
+    Update Mexican Library of Congress URL.
+
+
 Release 2014j - 2014-11-10 17:37:11 -0800
 
   Changes affecting current and future time stamps
Index: src/lib/libc/time/tz-art.htm
diff -u src/lib/libc/time/tz-art.htm:1.8 src/lib/libc/time/tz-art.htm:1.9
--- src/lib/libc/time/tz-art.htm:1.8	Thu Oct 23 14:45:58 2014
+++ src/lib/libc/time/tz-art.htm	Sat Jan 31 13:55:17 2015
@@ -330,8 +330,8 @@ is available at IMDb.</td></tr>
 <li>
 An episode of <em>The Adventures of Superman</em> entitled "The Mysterious
 Cube," first aired 1958-02-24, had Superman convincing the controllers
-of WWV to broadcast time signals five minutes ahead of actual time;
-doing so got a crook trying to beat the statute of limitations to
+of the Arlington Time Signal to broadcast ahead of actual time;
+doing so got a crook trying to be declared dead to
 emerge a bit too early from the titular enclosure.
 </li>
 <li>

Index: src/lib/libc/time/localtime.c
diff -u src/lib/libc/time/localtime.c:1.92 src/lib/libc/time/localtime.c:1.93
--- src/lib/libc/time/localtime.c:1.92	Tue Nov 11 13:46:54 2014
+++ src/lib/libc/time/localtime.c	Sat Jan 31 13:55:17 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.92 2014/11/11 18:46:54 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.93 2015/01/31 18:55:17 christos Exp $	*/
 
 /*
 ** This file is in the public domain, so clarified as of
@@ -10,7 +10,7 @@
 #if 0
 static char	elsieid[] = "@(#)localtime.c	8.17";
 #else
-__RCSID("$NetBSD: localtime.c,v 1.92 2014/11/11 18:46:54 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.93 2015/01/31 18:55:17 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -266,12 +266,11 @@ tzgetname(const timezone_t sp, int isdst
 }
 
 static void
-settzname_z(timezone_t sp)
+scrub_abbrs(struct state *sp)
 {
-	int			i;
+	int i;
 
 	/*
-	** Scrub the abbreviations.
 	** First, replace bogus characters.
 	*/
 	for (i = 0; i < sp->charcnt; ++i)
@@ -290,25 +289,18 @@ settzname_z(timezone_t sp)
 	}
 }
 
-static char *
-setzone(const struct state *sp, const struct ttinfo *ttisp, int_fast32_t offset)
+static void
+update_tzname_etc(const struct state *sp, const struct ttinfo *ttisp)
 {
-	char *zn = __UNCONST(&sp->chars[ttisp->tt_abbrind]);
-	if (offset) {
+	tzname[ttisp->tt_isdst] = __UNCONST(&sp->chars[ttisp->tt_abbrind]);
 #ifdef USG_COMPAT
-		if (ttisp->tt_isdst)
-			daylight = 1;
-		if (!ttisp->tt_isdst)
-			timezone = -(ttisp->tt_gmtoff);
-#endif /* defined USG_COMPAT */
+	if (!ttisp->tt_isdst)
+		timezone = - ttisp->tt_gmtoff;
+#endif
 #ifdef ALTZONE
-		if (ttisp->tt_isdst)
-			altzone = -(ttisp->tt_gmtoff);
+	if (ttisp->tt_isdst)
+	    altzone = - ttisp->tt_gmtoff;
 #endif /* defined ALTZONE */
-	}
-
-	tzname[ttisp->tt_isdst] = zn;
-	return zn;
 }
 
 static void
@@ -334,9 +326,16 @@ settzname(void)
 	** And to get the latest zone names into tzname. . .
 	*/
 	for (i = 0; i < sp->typecnt; ++i)
-		setzone(sp, &sp->ttis[i], -1);
+		update_tzname_etc(sp, &sp->ttis[i]);
 
-	settzname_z(sp);
+	for (i = 0; i < sp->timecnt; ++i) {
+		const struct ttinfo * const ttisp = &sp->ttis[sp->types[i]];
+		update_tzname_etc(sp, ttisp);
+#ifdef USG_COMPAT
+		if (ttisp->tt_isdst)
+			daylight = 1;
+#endif /* defined USG_COMPAT */
+	}
 }
 
 static bool
@@ -1251,7 +1250,9 @@ zoneinit(struct state *sp, char const *n
 		int err = tzload(name, sp, true);
 		if (err != 0 && name && name[0] != ':' &&
 		    tzparse(name, sp, false))
-			return 0;
+			err = 0;
+		if (err == 0)
+			scrub_abbrs(sp);
 		return err;
 	}
 }
@@ -1356,16 +1357,17 @@ tzfree(timezone_t sp)
 ** freely called. (And no, the PANS doesn't require the above behavior,
 ** but it *is* desirable.)
 **
-** If successful and OFFSET is nonzero,
+** If successful and SETNAME is nonzero,
 ** set the applicable parts of tzname, timezone and altzone;
 ** however, it's OK to omit this step if the time zone is POSIX-compatible,
 ** since in that case tzset should have already done this step correctly.
-** OFFSET's type is intfast32_t for compatibility with gmtsub.
+** SETNAME's type is intfast32_t for compatibility with gmtsub,
+** but it is actually a boolean and its value should be 0 or 1.
 */
 
 /*ARGSUSED*/
 static struct tm *
-localsub(struct state const *sp, time_t const *timep, int_fast32_t offset,
+localsub(struct state const *sp, time_t const *timep, int_fast32_t setname,
 	 struct tm *const tmp)
 {
 	const struct ttinfo *	ttisp;
@@ -1397,7 +1399,7 @@ localsub(struct state const *sp, time_t 
 				errno = EINVAL;
 				return NULL;	/* "cannot happen" */
 			}
-			result = localsub(sp, &newt, offset, tmp);
+			result = localsub(sp, &newt, setname, tmp);
 			if (result) {
 				int_fast64_t newy;
 
@@ -1437,11 +1439,12 @@ localsub(struct state const *sp, time_t 
 	*/
 	result = timesub(&t, ttisp->tt_gmtoff, sp, tmp);
 	if (result) {
-		char *zn = setzone(sp, ttisp, offset);
 		result->tm_isdst = ttisp->tt_isdst;
 #ifdef TM_ZONE
-		result->TM_ZONE = zn;
+		result->TM_ZONE = __UNCONST(&sp->chars[ttisp->tt_abbrind]);
 #endif /* defined TM_ZONE */
+		if (setname)
+			update_tzname_etc(sp, ttisp);
 	}
 	return result;
 }

Index: src/lib/libc/time/tz-link.htm
diff -u src/lib/libc/time/tz-link.htm:1.20 src/lib/libc/time/tz-link.htm:1.21
--- src/lib/libc/time/tz-link.htm:1.20	Mon Nov 17 20:58:59 2014
+++ src/lib/libc/time/tz-link.htm	Sat Jan 31 13:55:17 2015
@@ -8,7 +8,7 @@
 <meta http-equiv="Content-type" content='text/html; charset="UTF-8"'>
 <meta name="DC.Creator" content="Eggert, Paul">
 <meta name="DC.Contributor" content="Olson, Arthur David">
-<meta name="DC.Date" content="2014-11-09">
+<meta name="DC.Date" content="2015-01-29">
 <meta name="DC.Description"
  content="Sources of information about time zones and daylight saving time">
 <meta name="DC.Identifier"
@@ -47,7 +47,7 @@ title="Berkeley Software Distribution">B
 <a href="https://cygwin.com";>Cygwin</a>,
 <a href="http://www.delorie.com/djgpp/";><abbr
 title="DJ's GNU Programming Platform">DJGPP</abbr></a>,
-<a href="http://en.wikipedia.org/wiki/Symbian";>Symbian</a>,
+<a href="http://en.wikipedia.org/wiki/MINIX";>MINIX</a>,
 <a href="http://en.wikipedia.org/wiki/WebOS";><abbr
 title="Web Operating System">webOS</abbr></a>,
 <a href="http://ibm.com/aix";><abbr
@@ -245,8 +245,7 @@ href="http://www.w3.org/RDF/";><abbr
 title="Resource Description Framework">RDF</abbr></a>-based calendar
 and group scheduling systems, and has a <a
 href="http://www.w3.org/2002/12/cal/#tzd";>workspace on time zone
-data</a> converted from <code><abbr>tz</abbr></code>. An earlier <a
-href="http://www.w3.org/2000/01/foo";>schema</a> was sketched out.</li>
+data</a> converted from <code><abbr>tz</abbr></code>.</li>
 </ul>
 <h2>Other <code><abbr>tz</abbr></code> compilers</h2>
 <ul>

Index: src/lib/libc/time/tzselect.ksh
diff -u src/lib/libc/time/tzselect.ksh:1.12 src/lib/libc/time/tzselect.ksh:1.13
--- src/lib/libc/time/tzselect.ksh:1.12	Tue Oct  7 17:51:03 2014
+++ src/lib/libc/time/tzselect.ksh	Sat Jan 31 13:55:17 2015
@@ -1,6 +1,6 @@
 #! /bin/bash
 #
-#	$NetBSD: tzselect.ksh,v 1.12 2014/10/07 21:51:03 christos Exp $
+#	$NetBSD: tzselect.ksh,v 1.13 2015/01/31 18:55:17 christos Exp $
 #
 PKGVERSION='(tzcode) '
 TZVERSION=see_Makefile
@@ -230,10 +230,10 @@ output_distances='
   # case of the Vicenty formula for distances on ellipsoids.
   function gcdist(lat1, long1, lat2, long2, dlong, x, y, num, denom) {
     dlong = long2 - long1
-    x = cos (lat2) * sin (dlong)
-    y = cos (lat1) * sin (lat2) - sin (lat1) * cos (lat2) * cos (dlong)
-    num = sqrt (x * x + y * y)
-    denom = sin (lat1) * sin (lat2) + cos (lat1) * cos (lat2) * cos (dlong)
+    x = cos(lat2) * sin(dlong)
+    y = cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(dlong)
+    num = sqrt(x * x + y * y)
+    denom = sin(lat1) * sin(lat2) + cos(lat1) * cos(lat2) * cos(dlong)
     return atan2(num, denom)
   }
   # Parallel distance between points with given latitude and longitude.
@@ -242,12 +242,12 @@ output_distances='
   # I.e., it considers longitudes to be further apart if they are
   # nearer the equator.
   function pardist(lat1, long1, lat2, long2) {
-    return abs (long1 - long2) * min (cos (lat1), cos (lat2))
+    return abs(long1 - long2) * min(cos(lat1), cos(lat2))
   }
   # The distance function is the sum of the great-circle distance and
   # the parallel distance.  It could be weighted.
   function dist(lat1, long1, lat2, long2) {
-    return gcdist (lat1, long1, lat2, long2) + pardist (lat1, long1, lat2, long2)
+    return gcdist(lat1, long1, lat2, long2) + pardist(lat1, long1, lat2, long2)
   }
   BEGIN {
     coord_lat = convert_latitude(coord)
@@ -330,7 +330,7 @@ while
 				tzname = "[^-+,0-9][^-+,0-9][^-+,0-9]+"
 				time = "[0-2]?[0-9](:[0-5][0-9](:[0-5][0-9])?)?"
 				offset = "[-+]?" time
-				date = "(J?[0-9]+|M[0-9]+\.[0-9]+\.[0-9]+)"
+				date = "(J?[0-9]+|M[0-9]+\\.[0-9]+\\.[0-9]+)"
 				datetime = "," date "(/" time ")?"
 				tzpattern = "^(:.*|" tzname offset "(" tzname \
 				  "(" offset ")?(" datetime datetime ")?)?)$"
@@ -506,7 +506,7 @@ Universal Time is now:	$UTdate."
 	?*%%)	echo >&2 "	$country";;
 	%?*%?*) echo >&2 "	coord $coord$newline	$region";;
 	%%?*)	echo >&2 "	coord $coord";;
-	+)	echo >&2 "	TZ='$TZ'"
+	*)	echo >&2 "	TZ='$TZ'"
 	esac
 	echo >&2 ""
 	echo >&2 "Therefore TZ='$TZ' will be used.$extra_info"

Reply via email to