From 157c2da9c527cd9ebae03b07bdae90e474d5a403 Mon Sep 17 00:00:00 2001 From: Edwin Groothuis Date: Tue, 26 Oct 2010 21:19:36 +0000 Subject: Vendor import of tzcode2010n: * Makefile Change LOCALTIME default from "Factory" to "GMT"; do not compile "factory" file (but keep it in the distribution). * Theory Remove reference to "Factory" zone. * localtime.c Initialize ttinfo structures filled by tzparse (thanks to Ravindra for reporting a valgrind warning). * zic.c Fix generation of POSIX strings for zones with rules using "weekday<=n" forms of dates (thanks to Lei Liu for finding the problem). Also, limit output for non-POSIX-specificable zones defined to follow the same rules every year. (Note that no zones of either of the above types appear in the distribution; these changes cater to add-on zones). Obtained from: ftp://elsie.nci.nih.gov/pub/ --- libc/stdtime/localtime.c | 7 +++++-- unused/Makefile | 8 ++++---- zic/Theory | 5 ++--- zic/zic.c | 24 +++++++++++++++++++----- 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/libc/stdtime/localtime.c b/libc/stdtime/localtime.c index d397472dcdfdd..13c11aa928df6 100644 --- a/libc/stdtime/localtime.c +++ b/libc/stdtime/localtime.c @@ -5,7 +5,7 @@ #ifndef lint #ifndef NOID -static char elsieid[] = "@(#)localtime.c 8.14"; +static char elsieid[] = "@(#)localtime.c 8.15"; #endif /* !defined NOID */ #endif /* !defined lint */ @@ -914,6 +914,7 @@ const int lastditch; register unsigned char * typep; register char * cp; register int load_result; + static struct ttinfo zttinfo; INITIALIZE(dstname); stdname = name; @@ -986,6 +987,7 @@ const int lastditch; /* ** Two transitions per year, from EPOCH_YEAR forward. */ + sp->ttis[0] = sp->ttis[1] = zttinfo; sp->ttis[0].tt_gmtoff = -dstoffset; sp->ttis[0].tt_isdst = 1; sp->ttis[0].tt_abbrind = stdlen + 1; @@ -1099,8 +1101,8 @@ const int lastditch; } /* ** Finally, fill in ttis. - ** ttisstd and ttisgmt need not be handled. */ + sp->ttis[0] = sp->ttis[1] = zttinfo; sp->ttis[0].tt_gmtoff = -stdoffset; sp->ttis[0].tt_isdst = FALSE; sp->ttis[0].tt_abbrind = 0; @@ -1113,6 +1115,7 @@ const int lastditch; dstlen = 0; sp->typecnt = 1; /* only standard time */ sp->timecnt = 0; + sp->ttis[0] = zttinfo; sp->ttis[0].tt_gmtoff = -stdoffset; sp->ttis[0].tt_isdst = 0; sp->ttis[0].tt_abbrind = 0; diff --git a/unused/Makefile b/unused/Makefile index dd154b3010183..892d11619b58b 100644 --- a/unused/Makefile +++ b/unused/Makefile @@ -1,5 +1,5 @@ #
-# @(#)Makefile	8.8
+# @(#)Makefile	8.9
 # 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,
@@ -262,8 +262,8 @@ MANS=		newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
 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
diff --git a/zic/Theory b/zic/Theory
index abdad24849321..b1e6bd5c9d5da 100644
--- a/zic/Theory
+++ b/zic/Theory
@@ -1,4 +1,4 @@
-@(#)Theory	8.4
+@(#)Theory	8.5
 This file is in the public domain, so clarified as of
 2009-05-17 by Arthur David Olson.
 
@@ -287,8 +287,7 @@ and these older names are still supported.
 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 -----
diff --git a/zic/zic.c b/zic/zic.c
index 71ab562cf342f..a75d8c75e88c8 100644
--- a/zic/zic.c
+++ b/zic/zic.c
@@ -3,7 +3,7 @@
 ** 2006-07-17 by Arthur David Olson.
 */
 
-static char	elsieid[] = "@(#)zic.c	8.22";
+static char	elsieid[] = "@(#)zic.c	8.24";
 
 #include "private.h"
 #include "locale.h"
@@ -1881,16 +1881,16 @@ const long			gmtoff;
 		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",
@@ -2018,6 +2018,7 @@ const int			zonecount;
 	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;
@@ -2032,6 +2033,7 @@ const int			zonecount;
 	timecnt = 0;
 	typecnt = 0;
 	charcnt = 0;
+	prodstic = zonecount == 1;
 	/*
 	** Thanks to Earl Chew
 	** for noting the need to unconditionally initialize startttisstd.
@@ -2053,6 +2055,8 @@ const int			zonecount;
 				updateminmax(rp->r_loyear);
 			if (rp->r_hiwasnum)
 				updateminmax(rp->r_hiyear);
+			if (rp->r_lowasnum || rp->r_hiwasnum)
+				prodstic = FALSE;
 		}
 	}
 	/*
@@ -2075,6 +2079,16 @@ wp = ecpyalloc(_("no POSIX environment variable for zone"));
 		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,
-- 
cgit v1.2.3