summaryrefslogtreecommitdiffstats
path: root/contrib/tzcode/zic
diff options
context:
space:
mode:
authoredwin <edwin@FreeBSD.org>2010-10-27 07:14:46 +0000
committeredwin <edwin@FreeBSD.org>2010-10-27 07:14:46 +0000
commit73924f958881faa65dcbe928ea800fb849035b3a (patch)
treef574246b1541d1390385b1d20c652c38f2af29f4 /contrib/tzcode/zic
parentd60836560b70dc27168374f0b81dec9b77b09723 (diff)
downloadFreeBSD-src-73924f958881faa65dcbe928ea800fb849035b3a.zip
FreeBSD-src-73924f958881faa65dcbe928ea800fb849035b3a.tar.gz
Sync code with tzcode2010m
asctime.c: * Set errno to EINVAL and return "??? ??? ?? ??:??:?? ????\n" if asctime_r is called with a NULL struct tm pointer. (Note that asctime_r is called by ctime_r and asctime; asctime is called by ctime.) localtime.c: * Set errno to EINVAL and return WRONG if time1 is called with a NULL struct tm pointer; avoid dereference if a NULL struct tm pointer is passed to timelocal, timegm, or timeoff. (Note that time1 is called by mktime, timegm, and timeoff; mktime is called by timelocal.) * more core-avoidance work * Change to set timezone and altzone based on time types with greatest transition times (for the benefit of Asia/Seoul). zic.8: * Warning about case-sensitivity of names, but not of abbrevations zic.c: * Conditionally output extra types with most-recently-use offsets last (for use by systems with pre-2011 versions of localtime.c, helping to ensure that globals "altzone and "timezone" get set correctly). The code has been running for nearly four weeks on my laptop running FreeBSD 8.1 without a problem. MFC after: 1 month
Diffstat (limited to 'contrib/tzcode/zic')
-rw-r--r--contrib/tzcode/zic/zic.85
-rw-r--r--contrib/tzcode/zic/zic.c49
2 files changed, 52 insertions, 2 deletions
diff --git a/contrib/tzcode/zic/zic.8 b/contrib/tzcode/zic/zic.8
index fe09ef2..aa19131 100644
--- a/contrib/tzcode/zic/zic.8
+++ b/contrib/tzcode/zic/zic.8
@@ -119,6 +119,9 @@ Any line that is blank (after comment stripping) is ignored.
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:
@@ -460,6 +463,6 @@ standard directory used for created files
.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.
diff --git a/contrib/tzcode/zic/zic.c b/contrib/tzcode/zic/zic.c
index 7670056..5fb8b53 100644
--- a/contrib/tzcode/zic/zic.c
+++ b/contrib/tzcode/zic/zic.c
@@ -3,7 +3,7 @@
** 2006-07-17 by Arthur David Olson.
*/
-static const char elsieid[] = "@(#)zic.c 8.20";
+static const char elsieid[] = "@(#)zic.c 8.22";
#ifndef lint
static const char rcsid[] =
@@ -1588,6 +1588,53 @@ const char * const string;
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;
OpenPOWER on IntegriCloud