Module Name:    src
Committed By:   christos
Date:           Sun Sep  4 10:10:26 UTC 2011

Modified Files:
        src/lib/libc/time: Makefile Theory asctime.c localtime.c tz-art.htm
            tz-link.htm tzfile.5 zdump.c zic.8 zic.c

Log Message:
bring in the 2011i changes.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/time/Makefile
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/time/Theory
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/time/asctime.c
cvs rdiff -u -r1.57 -r1.58 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.1.1.4 -r1.2 src/lib/libc/time/tz-art.htm
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/time/tz-link.htm
cvs rdiff -u -r1.15 -r1.16 src/lib/libc/time/tzfile.5
cvs rdiff -u -r1.21 -r1.22 src/lib/libc/time/zdump.c
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/time/zic.8
cvs rdiff -u -r1.28 -r1.29 src/lib/libc/time/zic.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.3 src/lib/libc/time/Makefile:1.4
--- src/lib/libc/time/Makefile:1.3	Sat Jan 15 07:31:56 2011
+++ src/lib/libc/time/Makefile	Sun Sep  4 06:10:26 2011
@@ -1,5 +1,5 @@
 # <pre>
-# @(#)Makefile	8.8
+# @(#)Makefile	8.11
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -12,7 +12,7 @@
 #	make zonenames
 # to get a list of the values you can use for LOCALTIME.
 
-LOCALTIME=	Factory
+LOCALTIME=	GMT
 
 # If you want something other than Eastern United States time as a template
 # for handling POSIX-style time zone environment variables,
@@ -116,7 +116,7 @@
 #  -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 = -Dlint -g -O -fno-common \
+GCC_DEBUG_FLAGS = -Dlint -g -O3 -fno-common \
 	-Wall -Wcast-qual -Wconversion -Wmissing-prototypes \
 	-Wnested-externs -Wpointer-arith -Wshadow \
 	-Wtraditional # -Wstrict-prototypes -Wwrite-strings
@@ -262,15 +262,15 @@
 DOCS=		README Theory $(MANS) date.1 Makefile
 PRIMARY_YDATA=	africa antarctica asia australasia \
 		europe northamerica southamerica
-YDATA=		$(PRIMARY_YDATA) pacificnew etcetera factory backward
-NDATA=		systemv
+YDATA=		$(PRIMARY_YDATA) pacificnew etcetera backward
+NDATA=		systemv factory
 SDATA=		solar87 solar88 solar89
 TDATA=		$(YDATA) $(NDATA) $(SDATA)
 TABDATA=	iso3166.tab zone.tab
 DATA=		$(YDATA) $(NDATA) $(SDATA) $(TABDATA) leapseconds yearistype.sh
 WEB_PAGES=	tz-art.htm tz-link.htm
 MISC=		usno1988 usno1989 usno1989a usno1995 usno1997 usno1998 \
-			itca.jpg $(WEB_PAGES) checktab.awk workman.sh \
+			$(WEB_PAGES) checktab.awk workman.sh \
 			zoneinfo2tdf.pl
 ENCHILADA=	$(DOCS) $(SOURCES) $(DATA) $(MISC)
 

Index: src/lib/libc/time/Theory
diff -u src/lib/libc/time/Theory:1.9 src/lib/libc/time/Theory:1.10
--- src/lib/libc/time/Theory:1.9	Thu Dec 31 17:49:15 2009
+++ src/lib/libc/time/Theory	Sun Sep  4 06:10:26 2011
@@ -1,12 +1,13 @@
-#	$NetBSD: Theory,v 1.9 2009/12/31 22:49:15 mlelstv Exp $
-@(#)Theory	8.3
+#	$NetBSD: Theory,v 1.10 2011/09/04 10:10:26 christos Exp $
+@(#)Theory	8.6
 This file is in the public domain, so clarified as of
 2009-05-17 by Arthur David Olson.
 
 ----- Outline -----
 
 	Time and date functions
-	Names of time zone regions
+	Scope of the tz database
+	Names of time zone rule files
 	Time zone abbreviations
 	Calendrical issues
 	Time and time zones on Mars
@@ -193,6 +194,31 @@
 better.
 
 
+----- Scope of the tz database -----
+
+The tz database attempts to record the history and predicted future of 
+all computer-based clocks that track civil time.  To represent this 
+data, the world is partitioned into regions whose clocks all agree 
+about time stamps that occur after the somewhat-arbitrary cutoff point 
+of the POSIX Epoch (1970-01-01 00:00:00 UTC).  For each such region, 
+the database records all known clock transitions, and labels the region 
+with a notable location.
+
+Clock transitions before 1970 are recorded for each such location, 
+because most POSIX-compatible systems support negative time stamps and 
+could misbehave if data were omitted for pre-1970 transitions.
+However, the database is not designed for and does not suffice for 
+applications requiring accurate handling of all past times everywhere, 
+as it would take far too much effort and guesswork to record all 
+details of pre-1970 civil timekeeping.
+
+As noted in the README file, the tz database is not authoritative 
+(particularly not for pre-1970 time stamps), and it surely has errors.
+Corrections are welcome and encouraged.  Users requiring authoritative 
+data should consult national standards bodies and the references cited 
+in the database's comments.
+
+
 ----- Names of time zone rule files -----
 
 The time zone rule file naming conventions attempt to strike a balance
@@ -288,8 +314,7 @@
 See the file `backward' for most of these older names
 (e.g. `US/Eastern' instead of `America/New_York').
 The other old-fashioned names still supported are
-`WET', `CET', `MET', `EET' (see the file `europe'),
-and `Factory' (see the file `factory').
++`WET', `CET', `MET', and `EET' (see the file `europe').
 
 
 ----- Time zone abbreviations -----
@@ -361,10 +386,10 @@
 Calendrical issues are a bit out of scope for a time zone database,
 but they indicate the sort of problems that we would run into if we
 extended the time zone database further into the past.  An excellent
-resource in this area is Edward M. Reingold and Nachum Dershowitz,
-<a href="http://emr.cs.uiuc.edu/home/reingold/calendar-book/second-edition/";>
-Calendrical Calculations: The Millennium Edition
-</a>, Cambridge University Press (2001).  Other information and
+resource in this area is Nachum Dershowitz and Edward M. Reingold,
+<a href="http://emr.cs.iit.edu/home/reingold/calendar-book/third-edition/";>
+Calendrical Calculations: Third Edition
+</a>, Cambridge University Press (2008).  Other information and
 sources are given below.  They sometimes disagree.
 
 

Index: src/lib/libc/time/asctime.c
diff -u src/lib/libc/time/asctime.c:1.13 src/lib/libc/time/asctime.c:1.14
--- src/lib/libc/time/asctime.c:1.13	Thu Dec 31 17:49:16 2009
+++ src/lib/libc/time/asctime.c	Sun Sep  4 06:10:26 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: asctime.c,v 1.13 2009/12/31 22:49:16 mlelstv Exp $	*/
+/*	$NetBSD: asctime.c,v 1.14 2011/09/04 10:10:26 christos Exp $	*/
 
 /*
 ** This file is in the public domain, so clarified as of
@@ -14,9 +14,9 @@
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
 #if 0
-static char	elsieid[] = "@(#)asctime.c	8.2";
+static char	elsieid[] = "@(#)asctime.c	8.5";
 #else
-__RCSID("$NetBSD: asctime.c,v 1.13 2009/12/31 22:49:16 mlelstv Exp $");
+__RCSID("$NetBSD: asctime.c,v 1.14 2011/09/04 10:10:26 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -110,6 +110,10 @@
 	char			year[INT_STRLEN_MAXIMUM(int) + 2];
 	char			result[MAX_ASCTIME_BUF_SIZE];
 
+	if (timeptr == NULL) {
+		errno = EINVAL;
+		return strcpy(buf, "??? ??? ?? ??:??:?? ????\n");
+	}
 	if (timeptr->tm_wday < 0 || timeptr->tm_wday >= DAYSPERWEEK)
 		wn = "???";
 	else	wn = wday_name[timeptr->tm_wday];
@@ -130,10 +134,9 @@
 		timeptr->tm_mday, timeptr->tm_hour,
 		timeptr->tm_min, timeptr->tm_sec,
 		year);
-	if (strlen(result) < STD_ASCTIME_BUF_SIZE || buf == buf_asctime) {
-		(void) strcpy(buf, result);
-		return buf;
-	} else {
+	if (strlen(result) < STD_ASCTIME_BUF_SIZE || buf == buf_asctime)
+		return strcpy(buf, result);
+	else {
 #ifdef EOVERFLOW
 		errno = EOVERFLOW;
 #else /* !defined EOVERFLOW */

Index: src/lib/libc/time/localtime.c
diff -u src/lib/libc/time/localtime.c:1.57 src/lib/libc/time/localtime.c:1.58
--- src/lib/libc/time/localtime.c:1.57	Thu Jun 16 18:40:17 2011
+++ src/lib/libc/time/localtime.c	Sun Sep  4 06:10:26 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.57 2011/06/16 22:40:17 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.58 2011/09/04 10:10:26 christos Exp $	*/
 
 /*
 ** This file is in the public domain, so clarified as of
@@ -8,9 +8,9 @@
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
 #if 0
-static char	elsieid[] = "@(#)localtime.c	8.9";
+static char	elsieid[] = "@(#)localtime.c	8.17";
 #else
-__RCSID("$NetBSD: localtime.c,v 1.57 2011/06/16 22:40:17 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.58 2011/09/04 10:10:26 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -331,6 +331,9 @@
 		tzname[0] = tzname[1] = (__aconst char *)__UNCONST(gmt);
 		return;
 	}
+	/*
+	** And to get the latest zone names into tzname. . .
+	*/
 	for (i = 0; i < sp->typecnt; ++i) {
 		const struct ttinfo * const	ttisp = &sp->ttis[i];
 
@@ -339,7 +342,7 @@
 #ifdef USG_COMPAT
 		if (ttisp->tt_isdst)
 			daylight = 1;
-		if (i == 0 || !ttisp->tt_isdst)
+		if (!ttisp->tt_isdst)
 			timezone = -(ttisp->tt_gmtoff);
 #endif /* defined USG_COMPAT */
 #ifdef ALTZONE
@@ -347,17 +350,6 @@
 			altzone = -(ttisp->tt_gmtoff);
 #endif /* defined ALTZONE */
 	}
-	/*
-	** And to get the latest zone names into tzname. . .
-	*/
-	for (i = 0; i < sp->timecnt; ++i) {
-		register const struct ttinfo * const	ttisp =
-							&sp->ttis[
-								sp->types[i]];
-
-		tzname[ttisp->tt_isdst] =
-			&sp->chars[ttisp->tt_abbrind];
-	}
 	settzname_z(sp);
 }
 
@@ -379,16 +371,21 @@
 	int			fid;
 	int			stored;
 	int			nread;
-	union {
+	typedef union {
 		struct tzhead	tzhead;
 		char		buf[2 * sizeof(struct tzhead) +
 					2 * sizeof *sp +
 					4 * TZ_MAX_TIMES];
-	} u;
+	} u_t;
+	u_t *			up;
+
+	up = calloc(1, sizeof *up);
+	if (up == NULL)
+		return -1;
 
 	sp->goback = sp->goahead = FALSE;
 	if (name == NULL && (name = TZDEFAULT) == NULL)
-		return -1;
+		goto oops;
 	{
 		int	doaccess;
 		/*
@@ -405,9 +402,9 @@
 		doaccess = name[0] == '/';
 		if (!doaccess) {
 			if ((p = TZDIR) == NULL)
-				return -1;
+				goto oops;
 			if ((strlen(p) + strlen(name) + 1) >= sizeof fullname)
-				return -1;
+				goto oops;
 			(void) strcpy(fullname, p);	/* XXX strcpy is safe */
 			(void) strcat(fullname, "/");	/* XXX strcat is safe */
 			(void) strcat(fullname, name);	/* XXX strcat is safe */
@@ -419,7 +416,7 @@
 			name = fullname;
 		}
 		if (doaccess && access(name, R_OK) != 0)
-			return -1;
+			goto oops;
 		/*
 		 * XXX potential security problem here if user of a set-id
 		 * program has set TZ (which is passed in as name) here,
@@ -427,30 +424,30 @@
 		 * above.
 		 */
 		if ((fid = open(name, OPEN_MODE)) == -1)
-			return -1;
+			goto oops;
 	}
-	nread = read(fid, u.buf, sizeof u.buf);
+	nread = read(fid, up->buf, sizeof up->buf);
 	if (close(fid) < 0 || nread <= 0)
-		return -1;
+		goto oops;
 	for (stored = 4; stored <= 8; stored *= 2) {
 		int		ttisstdcnt;
 		int		ttisgmtcnt;
 
-		ttisstdcnt = (int) detzcode(u.tzhead.tzh_ttisstdcnt);
-		ttisgmtcnt = (int) detzcode(u.tzhead.tzh_ttisgmtcnt);
-		sp->leapcnt = (int) detzcode(u.tzhead.tzh_leapcnt);
-		sp->timecnt = (int) detzcode(u.tzhead.tzh_timecnt);
-		sp->typecnt = (int) detzcode(u.tzhead.tzh_typecnt);
-		sp->charcnt = (int) detzcode(u.tzhead.tzh_charcnt);
-		p = u.tzhead.tzh_charcnt + sizeof u.tzhead.tzh_charcnt;
+		ttisstdcnt = (int) detzcode(up->tzhead.tzh_ttisstdcnt);
+		ttisgmtcnt = (int) detzcode(up->tzhead.tzh_ttisgmtcnt);
+		sp->leapcnt = (int) detzcode(up->tzhead.tzh_leapcnt);
+		sp->timecnt = (int) detzcode(up->tzhead.tzh_timecnt);
+		sp->typecnt = (int) detzcode(up->tzhead.tzh_typecnt);
+		sp->charcnt = (int) detzcode(up->tzhead.tzh_charcnt);
+		p = up->tzhead.tzh_charcnt + sizeof up->tzhead.tzh_charcnt;
 		if (sp->leapcnt < 0 || sp->leapcnt > TZ_MAX_LEAPS ||
 			sp->typecnt <= 0 || sp->typecnt > TZ_MAX_TYPES ||
 			sp->timecnt < 0 || sp->timecnt > TZ_MAX_TIMES ||
 			sp->charcnt < 0 || sp->charcnt > TZ_MAX_CHARS ||
 			(ttisstdcnt != sp->typecnt && ttisstdcnt != 0) ||
 			(ttisgmtcnt != sp->typecnt && ttisgmtcnt != 0))
-				return -1;
-		if (nread - (p - u.buf) <
+				goto oops;
+		if (nread - (p - up->buf) <
 			sp->timecnt * stored +		/* ats */
 			sp->timecnt +			/* types */
 			sp->typecnt * 6 +		/* ttinfos */
@@ -458,7 +455,7 @@
 			sp->leapcnt * (stored + 4) +	/* lsinfos */
 			ttisstdcnt +			/* ttisstds */
 			ttisgmtcnt)			/* ttisgmts */
-				return -1;
+				goto oops;
 		for (i = 0; i < sp->timecnt; ++i) {
 			sp->ats[i] = (stored == 4) ?
 				detzcode(p) : detzcode64(p);
@@ -467,7 +464,7 @@
 		for (i = 0; i < sp->timecnt; ++i) {
 			sp->types[i] = (unsigned char) *p++;
 			if (sp->types[i] >= sp->typecnt)
-				return -1;
+				goto oops;
 		}
 		for (i = 0; i < sp->typecnt; ++i) {
 			struct ttinfo *	ttisp;
@@ -477,11 +474,11 @@
 			p += 4;
 			ttisp->tt_isdst = (unsigned char) *p++;
 			if (ttisp->tt_isdst != 0 && ttisp->tt_isdst != 1)
-				return -1;
+				goto oops;
 			ttisp->tt_abbrind = (unsigned char) *p++;
 			if (ttisp->tt_abbrind < 0 ||
 				ttisp->tt_abbrind > sp->charcnt)
-					return -1;
+					goto oops;
 		}
 		for (i = 0; i < sp->charcnt; ++i)
 			sp->chars[i] = *p++;
@@ -506,7 +503,7 @@
 				ttisp->tt_ttisstd = *p++;
 				if (ttisp->tt_ttisstd != TRUE &&
 					ttisp->tt_ttisstd != FALSE)
-						return -1;
+						goto oops;
 			}
 		}
 		for (i = 0; i < sp->typecnt; ++i) {
@@ -519,7 +516,7 @@
 				ttisp->tt_ttisgmt = *p++;
 				if (ttisp->tt_ttisgmt != TRUE &&
 					ttisp->tt_ttisgmt != FALSE)
-						return -1;
+						goto oops;
 			}
 		}
 		/*
@@ -553,11 +550,11 @@
 		/*
 		** If this is an old file, we're done.
 		*/
-		if (u.tzhead.tzh_version[0] == '\0')
+		if (up->tzhead.tzh_version[0] == '\0')
 			break;
-		nread -= p - u.buf;
+		nread -= p - up->buf;
 		for (i = 0; i < nread; ++i)
-			u.buf[i] = p[i];
+			up->buf[i] = p[i];
 		/*
 		** If this is a narrow integer time_t system, we're done.
 		*/
@@ -567,13 +564,13 @@
 			break;
 	}
 	if (doextend && nread > 2 &&
-		u.buf[0] == '\n' && u.buf[nread - 1] == '\n' &&
+		up->buf[0] == '\n' && up->buf[nread - 1] == '\n' &&
 		sp->typecnt + 2 <= TZ_MAX_TYPES) {
 			struct __state ts;
 			int	result;
 
-			u.buf[nread - 1] = '\0';
-			result = tzparse(&ts, &u.buf[1], FALSE);
+			up->buf[nread - 1] = '\0';
+			result = tzparse(&ts, &up->buf[1], FALSE);
 			if (result == 0 && ts.typecnt == 2 &&
 				sp->charcnt + ts.charcnt <= TZ_MAX_CHARS) {
 					for (i = 0; i < 2; ++i)
@@ -617,7 +614,11 @@
 					break;
 		}
 	}
+	free(up);
 	return 0;
+oops:
+	free(up);
+	return -1;
 }
 
 static int
@@ -1028,6 +1029,7 @@
 			/*
 			** Two transitions per year, from EPOCH_YEAR forward.
 			*/
+			memset(sp->ttis, 0, sizeof(sp->ttis));
 			sp->ttis[0].tt_gmtoff = -dstoffset;
 			sp->ttis[0].tt_isdst = 1;
 			sp->ttis[0].tt_abbrind = stdlen + 1;
@@ -1141,8 +1143,8 @@
 			}
 			/*
 			** Finally, fill in ttis.
-			** ttisstd and ttisgmt need not be handled.
 			*/
+			memset(sp->ttis, 0, sizeof(sp->ttis));
 			sp->ttis[0].tt_gmtoff = -stdoffset;
 			sp->ttis[0].tt_isdst = FALSE;
 			sp->ttis[0].tt_abbrind = 0;
@@ -1155,6 +1157,7 @@
 		dstlen = 0;
 		sp->typecnt = 1;		/* only standard time */
 		sp->timecnt = 0;
+		memset(sp->ttis, 0, sizeof(sp->ttis));
 		sp->ttis[0].tt_gmtoff = -stdoffset;
 		sp->ttis[0].tt_isdst = 0;
 		sp->ttis[0].tt_abbrind = 0;
@@ -1713,27 +1716,31 @@
 */
 
 static int
-increment_overflow(int *number, int delta)
+increment_overflow(int *ip, int j)
 {
-	int	number0;
+	int	i = *ip;
 
-	number0 = *number;
-	if (delta < 0 ? number0 < INT_MIN - delta : INT_MAX - delta < number0)
-		  return 1;
-	*number += delta;
-	return 0;
+	/*
+	** If i >= 0 there can only be overflow if i + j > INT_MAX
+	** or if j > INT_MAX - i; given i >= 0, INT_MAX - i cannot overflow.
+	** If i < 0 there can only be overflow if i + j < INT_MIN
+	** or if j < INT_MIN - i; given i < 0, INT_MIN - i cannot overflow.
+	*/
+	if ((i >= 0) ? (j > INT_MAX - i) : (j < INT_MIN - i))
+		return TRUE;
+	*ip += j;
+	return FALSE;
 }
 
 static int
-long_increment_overflow(long *number, int delta)
+long_increment_overflow(long *lp, int m)
 {
-	long	number0;
+	long l = *lp;
 
-	number0 = *number;
-	if (delta < 0 ? number0 < LONG_MIN - delta : LONG_MAX - delta < number0)
-		  return 1;
-	*number += delta;
-	return 0;
+	if ((l >= 0) ? (m > LONG_MAX - l) : (m < LONG_MIN - l))
+		return TRUE;
+	*lp += m;
+	return FALSE;
 }
 
 static int
@@ -1985,6 +1992,10 @@
 	int				types[TZ_MAX_TYPES];
 	int				okay;
 
+	if (tmp == NULL) {
+		errno = EINVAL;
+		return WRONG;
+	}
 	if (tmp->tm_isdst > 1)
 		tmp->tm_isdst = 1;
 	t = time2(sp, tmp, funcp, offset, &okay);
@@ -2077,7 +2088,8 @@
 time_t
 timelocal(struct tm *const tmp)
 {
-	tmp->tm_isdst = -1;	/* in case it wasn't initialized */
+	if (tmp != NULL)
+		tmp->tm_isdst = -1;	/* in case it wasn't initialized */
 	return mktime(tmp);
 }
 
@@ -2086,7 +2098,8 @@
 {
 	time_t t;
 
-	tmp->tm_isdst = 0;
+	if (tmp != NULL)
+		tmp->tm_isdst = 0;
 	t = time1(gmtptr, tmp, gmtsub, 0L);
 	if (t == WRONG)
 		errno = EOVERFLOW;
@@ -2098,7 +2111,8 @@
 {
 	time_t t;
 
-	tmp->tm_isdst = 0;
+	if (tmp != NULL)
+		tmp->tm_isdst = 0;
 	t = time1(gmtptr, tmp, gmtsub, offset);
 	if (t == WRONG)
 		errno = EOVERFLOW;

Index: src/lib/libc/time/tz-art.htm
diff -u src/lib/libc/time/tz-art.htm:1.1.1.4 src/lib/libc/time/tz-art.htm:1.2
--- src/lib/libc/time/tz-art.htm:1.1.1.4	Sun Oct 25 12:20:18 2009
+++ src/lib/libc/time/tz-art.htm	Sun Sep  4 06:10:26 2011
@@ -9,7 +9,7 @@
 <body>
 <h1>Time and the Arts</h1>
 <address>
-@(#)tz-art.htm	8.13
+@(#)tz-art.htm	8.20
 </address>
 <p>
 This file is in the public domain, so clarified as of
@@ -227,7 +227,30 @@
 <tr><td><a href="http://www.allmusic.com/cg/amg.dll?p=amg&sql=10:gifqxqt5ld0e";>AMG Rating</a></td><td>4.5 stars</td></tr>
 <tr><td>ADO Rating</td><td>1.5 stars</td></tr>
 <tr><td>Notes<td>The title song is also available on "Bob Dylan's Greatest Hits" and "The Essential Bob Dylan."</td></tr>
-
+<tr><td>&nbsp;</td></tr>
+ 
+<tr><td>Artist</td><td>Luciana Souza</td></tr>
+<tr><td>CD</td><td>Tide</td></tr>
+<tr><td>Copyright Date</td><td>2009</td></tr>
+<tr><td>Label</td><td>Universal Jazz France</td></tr>
+<tr><td>ID</td><td>B0012688-02</td></tr>
+<tr><td>Total Time</td><td>42:31</td></tr>
+<tr><td><a href="http://www.allmusic.com/cg/amg.dll?p=amg&sql=10:3bftxzw0ldhe";</a>AMG Rating</a></td><td>3.5 stars</td></tr>
+<tr><td>ADO Rating</td><td>2.5 stars</td></tr>
+<tr><td>Notes<td>Includes the song "Fire and Wood" with the lyric
+"The clocks were turned back you remeber/Think it's still November."
+</td></tr>
+<tr><td>&nbsp;</td></tr>
+<tr><td>Artist</td><td>Ken Nordine</td></tr>
+<tr><td>CD</td><td>You're Getting Better: The Word Jazz Dot Masters</td></tr>
+<tr><td>Copyright Date</td><td>2005</td></tr>
+<tr><td>Label</td><td>Geffen</td></tr>
+<tr><td>ID</td><td>B0005171-02</td></tr>
+<tr><td>Total Time</td><td>156:22</td></tr>
+<tr><td>ADO Rating</td><td>1 star</td></tr>
+<tr><td><a href="http://www.allmusic.com/album/youre-getting-better-the-word-jazz-dot-masters+r105931";>AMG Rating</a></td><td>4.5 stars</td></tr>
+<tr><td>Notes</td><td>Includes the piece "What Time Is It"
+("He knew what time it was everywhere...that counted").</td></tr>
 <tr><td>&nbsp;</td></tr>
 
 <tr><td>TV episode title</td><td>The Lost Hour</td>
@@ -354,7 +377,13 @@
 (originally aired 2007-02-28).
 </li>
 <li>
-In the 1946 "A Matter of Life and Death,"
+In the "30 Rock" episode "Anna Howard Shaw Day" (first broadcast 2010-02-11),
+Jack Donaghy's date realizes that a Geneva-to-New-York business phone call
+received in the evening must be fake given the difference in local times.
+</li>
+<li>
+In the 1946 movie "A Matter of Life and Death"
+(U.S. title "Stairway to Heaven")
 there is a reference to British Double Summer Time.
 The time does not play a large part in the plot;
 it's just a passing reference to the time when one of the
@@ -363,6 +392,36 @@
 <a href="http://us.imdb.com/title/tt0038733/";>
 http://us.imdb.com/title/tt0038733/
 </a>. (Dave Cantor)
+<li>
+The 1953 railway comedy movie "The Titfield Thunderbolt" includes a
+play on words on British Double Summer Time. Valentine's wife wants
+him to leave the pub and asks him, "Do you know what time it is?"
+And he, happy where he is, replies: "Yes, my love. Summer double time."
+IMDB page:
+<a href="http://us.imdb.com/title/tt0046436/";>
+http://us.imdb.com/title/tt0046436/
+</a>. (Mark Brader, 2009-10-02)
+</li>
+<li>
+The premise of the 1999 caper movie "Entrapment" involves computers
+in an international banking network being shut down briefly at
+midnight in each time zone to avoid any problems at the transition
+from the year 1999 to 2000 in that zone. (Hmmmm.) If this shutdown
+is extended by 10 seconds, it will create a one-time opportunity for
+a gigantic computerized theft. To achieve this, at one location the
+crooks interfere with the microwave system supplying time signals to
+the computer, advancing the time by 0.1 second each minute over the
+last hour of 1999. (So this movie teaches us that 0.1 x 60 = 10.)
+IMDB page:
+<a href="http://us.imdb.com/title/tt0137494/";>
+http://us.imdb.com/title/tt0137494/
+</a>. (Mark Brader, 2009-10-02)
+</li>
+<li>
+In "The Todd Couple" episode of "Outsourced" (first aired 2011-02-10),
+Manmeet sets up teledates for 6:00 and 9:00;
+since one is with a New Yorker and the other with a San Franciscan,
+hilarity ensues.
 </li>
 </ul>
 <hr>
@@ -374,6 +433,18 @@
 as noted by Will Fitzerald)
 </li>
 <li>
+Brady: "...[Bishop Usher] determined that the Lord began the Creation
+on the 23rd of October in the Year 4004 B.C. at -- uh, at 9 A.M.!"
+<br>
+Drummond: "That Eastern Standard Time? (Laughter)  Or Rocky Mountain
+Time? (More laughter)  It wasn't daylight-saving time, was it?  Because
+the Lord didn't make the sun until the fourth day!"
+<br>
+(From the play "Inherit the Wind" by Jerome Lawrence and Robert E. Lee,
+filmed in 1960 with Spencer Tracy as Drummond and Fredric March as
+Brady, and several other times. Thanks to Mark Brader.)
+</li>
+<li>
 "Good news."
 "What did they do? Extend Daylight Saving Time year round?"
 (Professional tanner George Hamilton, in dialog from a
@@ -412,6 +483,13 @@
 It is already tomorrow in Australia."
 (Charles M. Schulz, provided by Steve Summit)
 </li>
+<li>
+"I put myself and my staff through this crazy, huge ordeal, all because
+I refused to go on at midnight, okay?  And so I work, you know, and
+then I get this job at eleven, supposed to be a big deal.  Then
+yesterday daylight [saving] time ended. Right now it's basically
+midnight." (Conan O'Brien on the 2010-11-08 premier of "Conan.")
+</li>
 </ul>
 </body>
 </html>

Index: src/lib/libc/time/tz-link.htm
diff -u src/lib/libc/time/tz-link.htm:1.6 src/lib/libc/time/tz-link.htm:1.7
--- src/lib/libc/time/tz-link.htm:1.6	Thu Dec 31 17:49:16 2009
+++ src/lib/libc/time/tz-link.htm	Sun Sep  4 06:10:26 2011
@@ -18,7 +18,7 @@
 <body>
 <h1>Sources for Time Zone and Daylight Saving Time Data</h1>
 <address>
-@(#)tz-link.htm	8.22
+@(#)tz-link.htm	8.32
 </address>
 <p>
 This file is in the public domain, so clarified as of
@@ -40,8 +40,8 @@
 title="Coordinated Universal Time">UTC</abbr></a> offsets, and
 <a href="http://en.wikipedia.org/wiki/Daylight_saving";>daylight-saving</a>
 rules.
-This database (often called <code>tz</code> or <a
-href="http://en.wikipedia.org/wiki/Zoneinfo";><code>zoneinfo</code></a>)
+This database (often called <code>zoneinfo</code> or <a
+href="http://en.wikipedia.org/wiki/TZ_database";><code>tz</code></a>)
 is used by several implementations,
 including
 <a href="http://www.gnu.org/software/libc/";>the
@@ -89,12 +89,16 @@
 where <code><var>C</var></code> is the code's version;
 similarly, the data are in <code>tzdata<var>D</var>.tar.gz</code>,
 where <code><var>D</var></code> is the data's version.
+Each version is a four-digit year followed by lower-case letters
+(a through z, then za through zz, then zza through zzz, and so on).
 The following <a
 href="http://en.wikipedia.org/wiki/Unix_shell";>shell</a> commands download
 these files to a <abbr>GNU</abbr>/Linux or similar host;
 see the downloaded
 <code>README</code> file for what to do next.</p>
-<pre style="margin-left: 2em"><code><a href="http://www.gnu.org/software/wget/";>wget</a> 'ftp://elsie.nci.nih.gov/pub/tz*.tar.gz'
+<pre style="margin-left: 2em"><code>mkdir tz
+cd tz
+<a href="http://www.gnu.org/software/wget/";>wget</a> 'ftp://elsie.nci.nih.gov/pub/tz*.tar.gz'
 <a href="http://www.gnu.org/software/gzip/";>gzip</a> -dc tzcode*.tar.gz | <a href="http://www.gnu.org/software/tar/";>tar</a> -xf -
 gzip -dc tzdata*.tar.gz | tar -xf -
 </code></pre>
@@ -124,6 +128,14 @@
 These are listed roughly in ascending order of complexity and fanciness.
 </p>
 <ul>
+<li>
+<a href="http://permatime.com";>
+Permatime</a>
+is a service for generating and viewing links that refer to a
+particular point in time and can be displayed in multiple timezones.
+It uses the ruby tzinfo gem. 
+(From Tim Diggins, 2009-11-03.)
+</li>
 <li><a href="http://twiki.org/cgi-bin/xtra/tzdatepick.html";>Date and Time Gateway</a>
 lets you see the <code>TZ</code> values directly.</li>
 <li><a
@@ -141,6 +153,9 @@
 <li>The <a href="http://worldtimeengine.com/";>World Time Engine</a>
 also contains data about time zone boundaries; it supports queries via place
 names and shows location maps.</li>
+<li><a href="http://simpletimerclocks.mozdev.org/";>Simple Timer + Clocks</a>
+is a Firefox add-on which uses a timezone data file generated from the
+tz data files.</li>
 </ul>
 <h2>Other time zone database formats</h2>
 <ul>
@@ -297,6 +312,23 @@
 <li><a
 href="http://worldtimeexplorer.com/";>World Time Explorer</a> is a
 Microsoft Windows program.</li>
+<li>
+<a href="http://www.toriasoft.com";>
+WorldClock for Windows and Windows Mobile</a>
+lets users "see the time in up to 25 locations in the world at once."
+(From Hans Nieuwenhuis, 2009-11-02.)
+</li>
+<li>
+<a href="http://www.relativedata.com/time-zone-master";>
+Time Zone Master Basic
+</a> "allows people to display multiple desktop clocks, and to
+research current and historical time information, as well as times of
+astronomical events (sunrise/transit/set, moonrise/transit/set, phases,
+season starts) for user-selected dates in the past and future. It can
+automatically download, compile and use the tzdata**.gz database files
+as they are released to keep the data up to date. The software is
+free." (Davie Patte)
+</li>
 </ul>
 <h2>Other time zone databases</h2>
 <ul>
@@ -332,6 +364,17 @@
 &rarr; Tzid table</a> maintained by the <abbr
 title="Common Locale Data Repository">CLDR</abbr> data mentioned
 below.</li>
+<li>
+<a href="http://code.google.com/p/tzdata/";>
+http://code.google.com/p/tzdata/
+</a>
+provides programming-language-specific representations of timezone
+data. Currently this includes XML, PHP, Ruby, Javascript, JSON and CSV
+formatted data. The repository is updated as soon as the FTP
+distribution is updated. All data can be downloaded as a zip and/or it
+can be obtained/synced via anonymous SVN. Data is made available under
+the MIT license. (From Rich Tibbett.)
+</li>
 </ul>
 <h2>Maps</h2>
 <ul>

Index: src/lib/libc/time/tzfile.5
diff -u src/lib/libc/time/tzfile.5:1.15 src/lib/libc/time/tzfile.5:1.16
--- src/lib/libc/time/tzfile.5:1.15	Fri Jan  8 18:14:13 2010
+++ src/lib/libc/time/tzfile.5	Sun Sep  4 06:10:26 2011
@@ -1,4 +1,4 @@
-.\"	$NetBSD: tzfile.5,v 1.15 2010/01/08 23:14:13 joerg Exp $
+.\"	$NetBSD: tzfile.5,v 1.16 2011/09/04 10:10:26 christos Exp $
 .\"
 .\" @(#)tzfile.5	7.11
 .\" This file is in the public domain, so clarified as of
@@ -154,6 +154,6 @@
 .Xr ctime 3 ,
 .Xr localtime 3 ,
 .Xr time 3
-.\" @(#)tzfile.5	8.2
+.\" @(#)tzfile.5	8.3
 .\" This file is in the public domain, so clarified as of
 .\" 1996-06-05 by Arthur David Olson.

Index: src/lib/libc/time/zdump.c
diff -u src/lib/libc/time/zdump.c:1.21 src/lib/libc/time/zdump.c:1.22
--- src/lib/libc/time/zdump.c:1.21	Wed Aug 24 03:51:31 2011
+++ src/lib/libc/time/zdump.c	Sun Sep  4 06:10:26 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: zdump.c,v 1.21 2011/08/24 07:51:31 christos Exp $	*/
+/*	$NetBSD: zdump.c,v 1.22 2011/09/04 10:10:26 christos Exp $	*/
 /*
 ** This file is in the public domain, so clarified as of
 ** 2009-05-17 by Arthur David Olson.
@@ -7,11 +7,11 @@
 #include <sys/cdefs.h>
 #ifndef lint
 #ifndef NOID
-__RCSID("$NetBSD: zdump.c,v 1.21 2011/08/24 07:51:31 christos Exp $");
+__RCSID("$NetBSD: zdump.c,v 1.22 2011/09/04 10:10:26 christos Exp $");
 #endif /* !defined NOID */
 #endif /* !defined lint */
 
-static char	elsieid[] = "@(#)zdump.c	8.9";
+static char	elsieid[] = "@(#)zdump.c	8.10";
 
 /*
 ** This code has been made independent of the rest of the time
@@ -245,13 +245,13 @@
 }
 
 static void
-usage(const char *xprogname, FILE *stream, int status)
+usage(FILE *stream, int status)
 {
 	(void) fprintf(stream,
 _("%s: usage is %s [ --version ] [ --help ] [ -v ] [ -c [loyear,]hiyear ] zonename ...\n\
 \n\
 Report bugs to [email protected].\n"),
-		       xprogname, xprogname);
+		       progname, progname);
 	exit(status);
 }
 
@@ -292,7 +292,7 @@
 			(void) printf("%s\n", elsieid);
 			exit(EXIT_SUCCESS);
 		} else if (strcmp(argv[i], "--help") == 0) {
-			usage(progname, stdout, EXIT_SUCCESS);
+			usage(stdout, EXIT_SUCCESS);
 		}
 	vflag = 0;
 	cutarg = NULL;

Index: src/lib/libc/time/zic.8
diff -u src/lib/libc/time/zic.8:1.18 src/lib/libc/time/zic.8:1.19
--- src/lib/libc/time/zic.8:1.18	Sun May 30 03:57:08 2010
+++ src/lib/libc/time/zic.8	Sun Sep  4 06:10:26 2011
@@ -1,4 +1,4 @@
-.\"	$NetBSD: zic.8,v 1.18 2010/05/30 07:57:08 wiz Exp $
+.\"	$NetBSD: zic.8,v 1.19 2011/09/04 10:10:26 christos Exp $
 .\" @(#)zic.8	7.22
 .Dd December 20, 2003
 .Dt ZIC 8
@@ -82,6 +82,9 @@
 Non-blank lines are expected to be of one of three types:
 rule lines, zone lines, and link lines.
 .Pp
+Names (such as month names) must be in English and are case insensitive.
+Abbreviations, if used, must be unambiguous in context.
+.Pp
 A rule line has the form
 .Dl Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 For example:
@@ -422,6 +425,6 @@
 .Xr ctime 3 ,
 .Xr tzfile 5 ,
 .Xr zdump 8
-.\" @(#)zic.8	8.5
+.\" @(#)zic.8	8.6
 .\" This file is in the public domain, so clarified as of
 .\" 2009-05-17 by Arthur David Olson.

Index: src/lib/libc/time/zic.c
diff -u src/lib/libc/time/zic.c:1.28 src/lib/libc/time/zic.c:1.29
--- src/lib/libc/time/zic.c:1.28	Sat Jan 15 07:31:57 2011
+++ src/lib/libc/time/zic.c	Sun Sep  4 06:10:26 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: zic.c,v 1.28 2011/01/15 12:31:57 martin Exp $	*/
+/*	$NetBSD: zic.c,v 1.29 2011/09/04 10:10:26 christos Exp $	*/
 /*
 ** This file is in the public domain, so clarified as of
 ** 2006-07-17 by Arthur David Olson.
@@ -10,10 +10,10 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: zic.c,v 1.28 2011/01/15 12:31:57 martin Exp $");
+__RCSID("$NetBSD: zic.c,v 1.29 2011/09/04 10:10:26 christos Exp $");
 #endif /* !defined lint */
 
-static char	elsieid[] = "@(#)zic.c	8.20";
+static char	elsieid[] = "@(#)zic.c	8.25";
 
 #include "private.h"
 #include "locale.h"
@@ -1637,6 +1637,53 @@
 			if (thistimei == 0)
 				writetype[0] = TRUE;
 		}
+#ifndef LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH
+		/*
+		** For some pre-2011 systems: if the last-to-be-written
+		** standard (or daylight) type has an offset different from the
+		** most recently used offset,
+		** append an (unused) copy of the most recently used type
+		** (to help get global "altzone" and "timezone" variables
+		** set correctly).
+		*/
+		{
+			register int	mrudst, mrustd, hidst, histd, type;
+
+			hidst = histd = mrudst = mrustd = -1;
+			for (i = thistimei; i < thistimelim; ++i)
+				if (isdsts[types[i]])
+					mrudst = types[i];
+				else	mrustd = types[i];
+			for (i = 0; i < typecnt; ++i)
+				if (writetype[i]) {
+					if (isdsts[i])
+						hidst = i;
+					else	histd = i;
+				}
+			if (hidst >= 0 && mrudst >= 0 && hidst != mrudst &&
+				gmtoffs[hidst] != gmtoffs[mrudst]) {
+					isdsts[mrudst] = -1;
+					type = addtype(gmtoffs[mrudst],
+						&chars[abbrinds[mrudst]],
+						TRUE,
+						ttisstds[mrudst],
+						ttisgmts[mrudst]);
+					isdsts[mrudst] = TRUE;
+					writetype[type] = TRUE;
+			}
+			if (histd >= 0 && mrustd >= 0 && histd != mrustd &&
+				gmtoffs[histd] != gmtoffs[mrustd]) {
+					isdsts[mrustd] = -1;
+					type = addtype(gmtoffs[mrustd],
+						&chars[abbrinds[mrustd]],
+						FALSE,
+						ttisstds[mrustd],
+						ttisgmts[mrustd]);
+					isdsts[mrustd] = FALSE;
+					writetype[type] = TRUE;
+			}
+		}
+#endif /* !defined LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH */
 		thistypecnt = 0;
 		for (i = 0; i < typecnt; ++i)
 			typemap[i] = writetype[i] ?  thistypecnt++ : -1;
@@ -1852,16 +1899,16 @@
 		register int	week;
 
 		if (rp->r_dycode == DC_DOWGEQ) {
-			week = 1 + rp->r_dayofmonth / DAYSPERWEEK;
-			if ((week - 1) * DAYSPERWEEK + 1 != rp->r_dayofmonth)
+			if ((rp->r_dayofmonth % DAYSPERWEEK) != 1)
 				return -1;
+			week = 1 + rp->r_dayofmonth / DAYSPERWEEK;
 		} else if (rp->r_dycode == DC_DOWLEQ) {
 			if (rp->r_dayofmonth == len_months[1][rp->r_month])
 				week = 5;
 			else {
-				week = 1 + rp->r_dayofmonth / DAYSPERWEEK;
-				if (week * DAYSPERWEEK - 1 != rp->r_dayofmonth)
+				if ((rp->r_dayofmonth % DAYSPERWEEK) != 0)
 					return -1;
+				week = rp->r_dayofmonth / DAYSPERWEEK;
 			}
 		} else	return -1;	/* "cannot happen" */
 		(void) sprintf(result, "M%d.%d.%d",
@@ -1991,6 +2038,7 @@
 	register char *			envvar;
 	register int			max_abbr_len;
 	register int			max_envvar_len;
+	register int			prodstic; /* all rules are min to max */
 
 	max_abbr_len = 2 + max_format_len + max_abbrvar_len;
 	max_envvar_len = 2 * max_abbr_len + 5 * 9;
@@ -2005,6 +2053,7 @@
 	timecnt = 0;
 	typecnt = 0;
 	charcnt = 0;
+	prodstic = zonecount == 1;
 	/*
 	** Thanks to Earl Chew
 	** for noting the need to unconditionally initialize startttisstd.
@@ -2048,6 +2097,16 @@
 		if (max_year <= INT_MAX - YEARSPERREPEAT)
 			max_year += YEARSPERREPEAT;
 		else	max_year = INT_MAX;
+		/*
+		** Regardless of any of the above,
+		** for a "proDSTic" zone which specifies that its rules
+		** always have and always will be in effect,
+		** we only need one cycle to define the zone.
+		*/
+		if (prodstic) {
+			min_year = 1900;
+			max_year = min_year + YEARSPERREPEAT;
+		}
 	}
 	/*
 	** For the benefit of older systems,

Reply via email to