summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-06-28 14:47:42 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-06-28 14:47:42 +0000
commit649064f54e1db5353b15212220a0f4820bc702e0 (patch)
treea15440db070e684b9ef6184884dc61ad194185b9
parentd922b4f13ca6b3c833a086a78358151b7df3ff07 (diff)
merge in tzcode2004a
-rw-r--r--lib/libc/time/Theory54
-rw-r--r--lib/libc/time/localtime.c31
-rw-r--r--lib/libc/time/private.h6
-rw-r--r--lib/libc/time/tz-link.htm65
-rw-r--r--lib/libc/time/zic.86
-rw-r--r--lib/libc/time/zic.c12
6 files changed, 145 insertions, 29 deletions
diff --git a/lib/libc/time/Theory b/lib/libc/time/Theory
index 771ad484cff..e0828139a8b 100644
--- a/lib/libc/time/Theory
+++ b/lib/libc/time/Theory
@@ -1,5 +1,5 @@
-$OpenBSD: Theory,v 1.8 2002/04/04 19:12:09 millert Exp $
-@(#)Theory 7.13
+$OpenBSD: Theory,v 1.9 2004/06/28 14:47:41 millert Exp $
+@(#)Theory 7.15
----- Outline -----
@@ -8,12 +8,13 @@ $OpenBSD: Theory,v 1.8 2002/04/04 19:12:09 millert Exp $
Names of time zone regions
Time zone abbreviations
Calendrical issues
+ Time and time zones on Mars
----- Time and date functions -----
These time and date functions are upwards compatible with POSIX.1,
-an international standard for Unix-like systems.
+an international standard for UNIX-like systems.
As of this writing, the current edition of POSIX.1 is:
Information technology --Portable Operating System Interface (POSIX (R))
@@ -145,7 +146,7 @@ Points of interest to folks with other systems:
since the format of zic's input changed slightly in late 1994,
and many vendors still do not support the new input format.
-* The Unix Version 7 "timezone" function is not present in this package;
+* The UNIX Version 7 "timezone" function is not present in this package;
it's impossible to reliably map timezone's arguments (a "minutes west
of GMT" value and a "daylight saving time in effect" flag) to a
time zone abbreviation, and we refuse to guess.
@@ -505,3 +506,48 @@ convert to the Gregorian calendar until the Soviet revolution of 1917.
Source: H. Grotefend, _Taschenbuch der Zeitrechnung des deutschen
Mittelalters und der Neuzeit_, herausgegeben von Dr. O. Grotefend
(Hannover: Hahnsche Buchhandlung, 1941), pp. 26-28.
+
+
+----- Time and time zones on Mars -----
+
+Some people have adjusted their work schedules to fit Mars time.
+Dozens of special Mars watches were built for Jet Propulsion
+Laboratory workers who kept Mars time during the Mars Exploration
+Rovers mission (2004). These timepieces look like normal Seikos and
+Citizens but use Mars seconds rather than terrestrial seconds.
+
+A Mars solar day is called a "sol" and has a mean period equal to
+about 24 hours 39 minutes 35.244 seconds in terrestrial time. It is
+divided into a conventional 24-hour clock, so each Mars second equals
+about 1.02749125 terrestrial seconds.
+
+The prime meridian of Mars goes through the center of the crater
+Airy-0, named in honor of the British astronomer who built the
+Greenwich telescope that defines Earth's prime meridian. Mean solar
+time on the Mars prime meridian is called Mars Coordinated Time (MTC).
+
+Each landed mission on Mars has adopted a different reference for
+solar time keeping, so there is no real standard for Mars time zones.
+For example, the Mars Exploration Rover project (2004) defined two
+time zones "Local Solar Time A" and "Local Solar Time B" for its two
+missions, each zone designed so that its time equals local true solar
+time at approximately the middle of the nominal mission. Such a "time
+zone" is not particularly suited for any application other than the
+mission itself.
+
+Many calendars have been proposed for Mars, but none have achieved
+wide acceptance. Astronomers often use Mars Sol Date (MSD) which is a
+sequential count of Mars solar days elapsed since about 1873-12-29
+12:00 GMT.
+
+The tz database does not currently support Mars time, but it is
+documented here in the hopes that support will be added eventually.
+
+Sources:
+
+Michael Allison and Robert Schmunk,
+"Technical Notes on Mars Solar Time as Adopted by the Mars24 Sunclock"
+<http://www.giss.nasa.gov/tools/mars24/help/notes.html> (2004-03-15).
+
+Jia-Rui Chong, "Workdays Fit for a Martian", Los Angeles Times
+(2004-01-14), pp A1, A20-A21.
diff --git a/lib/libc/time/localtime.c b/lib/libc/time/localtime.c
index 997159bdb53..59615a97971 100644
--- a/lib/libc/time/localtime.c
+++ b/lib/libc/time/localtime.c
@@ -4,8 +4,8 @@
*/
#if defined(LIBC_SCCS) && !defined(lint) && !defined(NOID)
-static char elsieid[] = "@(#)localtime.c 7.76";
-static char rcsid[] = "$OpenBSD: localtime.c,v 1.23 2003/10/06 00:17:13 millert Exp $";
+static char elsieid[] = "@(#)localtime.c 7.78";
+static char rcsid[] = "$OpenBSD: localtime.c,v 1.24 2004/06/28 14:47:41 millert Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -1064,6 +1064,10 @@ struct tm * const tmp;
#endif /* defined TM_ZONE */
}
+/*
+** Re-entrant version of localtime.
+*/
+
struct tm *
localtime_r(timep, p_tm)
const time_t * const timep;
@@ -1130,6 +1134,10 @@ struct tm * const tmp;
#endif /* defined TM_ZONE */
}
+/*
+** Re-entrant version of gmtime.
+*/
+
struct tm *
gmtime_r(timep, p_tm)
const time_t * timep;
@@ -1531,6 +1539,11 @@ const long offset;
register time_t t;
register const struct state * sp;
register int samei, otheri;
+ register int sameind, otherind;
+ register int i;
+ register int nseen;
+ int seen[TZ_MAX_TYPES];
+ int types[TZ_MAX_TYPES];
int okay;
if (tmp->tm_isdst > 1)
@@ -1564,10 +1577,20 @@ const long offset;
if (sp == NULL)
return WRONG;
#endif /* defined ALL_STATE */
- for (samei = sp->typecnt - 1; samei >= 0; --samei) {
+ for (i = 0; i < sp->typecnt; ++i)
+ seen[i] = FALSE;
+ nseen = 0;
+ for (i = sp->timecnt - 1; i >= 0; --i)
+ if (!seen[sp->types[i]]) {
+ seen[sp->types[i]] = TRUE;
+ types[nseen++] = sp->types[i];
+ }
+ for (sameind = 0; sameind < nseen; ++sameind) {
+ samei = types[sameind];
if (sp->ttis[samei].tt_isdst != tmp->tm_isdst)
continue;
- for (otheri = sp->typecnt - 1; otheri >= 0; --otheri) {
+ for (otherind = 0; otherind < nseen; ++otherind) {
+ otheri = types[otherind];
if (sp->ttis[otheri].tt_isdst == tmp->tm_isdst)
continue;
tmp->tm_sec += sp->ttis[otheri].tt_gmtoff -
diff --git a/lib/libc/time/private.h b/lib/libc/time/private.h
index 5d402fde11d..b1b6b10e0ab 100644
--- a/lib/libc/time/private.h
+++ b/lib/libc/time/private.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: private.h,v 1.14 2002/04/04 19:12:09 millert Exp $ */
+/* $OpenBSD: private.h,v 1.15 2004/06/28 14:47:41 millert Exp $ */
#ifndef PRIVATE_H
#define PRIVATE_H
@@ -33,7 +33,7 @@
#if 0
#ifndef lint
#ifndef NOID
-static char privatehid[] = "@(#)private.h 7.52";
+static char privatehid[] = "@(#)private.h 7.53";
#endif /* !defined NOID */
#endif /* !defined lint */
#endif
@@ -305,7 +305,7 @@ char *ctime_r P((time_t const *, char *));
#endif /* HAVE_INCOMPATIBLE_CTIME_R */
/*
-** UNIX was a registered trademark of UNIX System Laboratories in 1993.
+** UNIX was a registered trademark of The Open Group in 2003.
*/
#endif /* !defined PRIVATE_H */
diff --git a/lib/libc/time/tz-link.htm b/lib/libc/time/tz-link.htm
index b27e8b800eb..0e630730070 100644
--- a/lib/libc/time/tz-link.htm
+++ b/lib/libc/time/tz-link.htm
@@ -9,7 +9,7 @@
<meta http-equiv="Content-type" content='text/html; charset="US-ASCII"' />
<meta name="DC.Creator" content="Eggert, Paul" />
<meta name="DC.Contributor" content="Olson, Arthur David" />
-<meta name="DC.Date" content="2003-09-21" />
+<meta name="DC.Date" content="2004-05-24" />
<meta name="DC.Description"
content="Sources of information about time zones and daylight saving time" />
<meta name="DC.Identifier" content="http://www.twinsun.com/tz/tz-link.htm" />
@@ -19,7 +19,7 @@
<body>
<h1>Sources for Time Zone and Daylight Saving Time Data</h1>
<address>
-@(#)tz-link.htm 7.39
+@(#)tz-link.htm 7.42
</address>
<p>
Please send corrections to this web page to the
@@ -88,17 +88,19 @@ The data are by no means authoritative. If you find errors, please
send changes to the <a href="mailto:tz@elsie.nci.nih.gov">time zone
mailing list</a>. You can also <a
href="mailto:tz-request@elsie.nci.nih.gov">subscribe</a> to the
-mailing list, or retrieve the <a
+mailing list, retrieve the <a
href="ftp://elsie.nci.nih.gov/pub/tzarchive.gz">archive of old
-messages</a> (in gzip compressed format).</p>
+messages</a> (in gzip compressed format), or retrieve <a
+href="ftp://munnari.oz.au/pub/oldtz/">archived older versions of code
+and data</a>.</p>
<p>
The Web has several other sources for time zone and daylight saving time data.
Here are some recent links that may be of interest.
</p>
<h2>Web pages using recent versions of the <code>tz</code> database</h2>
<ul>
-<li><a href="http://www.bsdi.com/date/">Date and Time Gateway</a> is a
-text-based point-and-click interface to tables of current time
+<li><a href="http://twiki.org/cgi-bin/xtra/tzdate">Date and Time Gateway</a>
+is a text-based point-and-click interface to tables of current time
throughout the world.</li>
<li>Fancier web interfaces, roughly in ascending order of complexity, include:
<ul>
@@ -124,7 +126,7 @@ href="http://www.ietf.org/html.charters/calsch-charter.html">IETF
Calendaring and Scheduling Working Group (calsch)</a> covers time zone
data; see its VTIMEZONE calendar component.</li>
<li>The <a
-href="http://lists.w3.org/Archives/Public/www-rdf-calendar/"><samp>www-rdf-calendar</samp></a>
+href="http://lists.w3.org/Archives/Public/www-rdf-calendar/">www-rdf-calendar</a>
list discusses <a href="http://www.w3.org/RDF/">RDF</a>-based calendar
and group scheduling systems, and has a <a
href="http://www.w3.org/2002/12/cal/#tzd">workspace on time zone
@@ -138,11 +140,32 @@ definition that corresponded to iCalendar.</li>
</ul>
<h2>Other <code>tz</code> compilers</h2>
<ul>
-<li><a href="http://primates.ximian.com/~damon/icalendar/">Olson ->
-VTIMEZONE Converter</a> describes a program Vzic that
-compiles <code>tz</code> source into iCalendar format. Vzic is freely
+<li><a href="http://www.dachaplin.dsl.pipex.com/vzic">Vzic iCalendar
+Timezone Converter</a> describes a program Vzic that compiles
+<code>tz</code> source into iCalendar-compatible VTIMEZONE files.
+Vzic is freely
available under the <a href="http://www.gnu.org/copyleft/gpl.html">GNU
General Public License (GPL)</a>.</li>
+<li><a
+href="http://search.cpan.org/dist/DateTime-TimeZone/">DateTime::TimeZone</a>
+contains a script <code>parse_olson</code> that compiles
+<code>tz</code> source into <a href="http://www.perl.org/">Perl</a>
+modules. It is part of the Perl <a
+href="http://datetime.perl.org/">DateTime Project</a>, which is freely
+available under both the GPL and the Perl <a
+href="http://www.perl.com/language/misc/Artistic.html">Artistic
+License</a>. DateTime::TimeZone also contains a script
+<code>tests_from_zdump</code> that generates test cases for each clock
+transition in the <code>tz</code> database.</li>
+<li><a href="http://oss.software.ibm.com/icu/">International Components for
+Unicode (ICU)</a> contains a C/C++ library for internationalization that
+has a compiler from <samp>tz</samp> source into an ICU-specific format.
+ICU is freely available under a BSD-style license.</li>
+<li><a href="http://joda-time.sourceforge.net/">Joda Time - Java date
+and time API</a> contains a class
+<code>org.joda.time.tz.ZoneInfoCompiler</code> that compiles
+<code>tz</code> source into a Joda-specific binary format. Joda Time
+is freely available under a BSD-style license.</li>
</ul>
<h2>Other <code>tz</code> binary file readers</h2>
<ul>
@@ -163,6 +186,9 @@ under a BSD-style license.</li>
</ul>
<h2>Other <code>tz</code>-based time zone conversion software</h2>
<ul>
+<li><a href="http://java.sun.com/">Sun Java</a> releases since 1.4
+contain a copy of a recent <samp>tz</samp> database in a Java-specific
+format.</li>
<li><a
href="http://www1.tip.nl/~t876506/AboutTimeZonesHC.html">HyperCard
time zones calculator</a> is a HyperCard stack.</li>
@@ -220,6 +246,9 @@ but the maps are more up to date.</li>
</ul>
<h2>Time zone boundaries</h2>
<ul>
+<li><a href="http://home-4.tiscali.nl/~t876506/Multizones.html">Time
+zone boundaries for multizone countries</a> summarizes legal
+boundaries between time zones within countries.</li>
<li>Manifold.net's <a
href="http://www.manifold.net/download/freemaps.html">Free Maps and
GIS Data</a> includes a Manifold-format map of world time zone
@@ -248,7 +277,7 @@ The time zone map is out of date, however.</li>
<li><a href="http://www.phys.uu.nl/~vgent/idl/idl.htm">A History of
the International Date Line</a> tells the story of the most important
time zone boundary.</li>
-<li><a href="http://www.mindspring.com/~gwil/tconcept.html">Basic Time
+<li><a href="http://www.statoids.com/tconcept.html">Basic Time
Zone Concepts</a> discusses terminological issues behind time zones.</li>
</ul>
<h2>National histories of legal time</h2>
@@ -294,6 +323,8 @@ hreflang="he">announcements (in Hebrew)</a>.</dd>
Congress has published a <a
href="http://www.cddhcu.gob.mx/bibliot/publica/inveyana/polisoc/horver/"
hreflang="es">history of Mexican local time (in Spanish)</a>.</dd>
+<dt>Malaysia</dt>
+<dd>See Singapore below.</dd>
<dt>Netherlands</dt>
<dd><a href="http://www.phys.uu.nl/~vgent/wettijd/wettijd.htm"
hreflang="nl">Legal time in the Netherlands (in Dutch)</a>
@@ -304,9 +335,14 @@ href="http://www.dia.govt.nz/diawebsite.nsf/wpg_URL/Resource-material-Informatio
daylight saving</a>. The privately-maintained <a
href="http://www.astrologyhouse.co.nz/timechanges.htm">Time Changes in
New Zealand</a> has more details.</dd>
+<dt>Singapore</dt>
+<dd><a
+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>
<dt>United Kingdom</dt>
<dd><a
-href="http://student.cusu.cam.ac.uk/~jsm28/british-time/">History of
+href="http://www.srcf.ucam.org/~jsm28/british-time/">History of
legal time in Britain</a> discusses in detail the country
with perhaps the best-documented history of clock adjustments.
The National Physical Laboratory also maintains an <a
@@ -338,6 +374,11 @@ among time scales like TAI, TDB, TT and UTC.</li>
Space Flight - Reference Systems - Time Conventions</a>
briefly explains interplanetary space flight timekeeping.</li>
<li><a
+href="http://www.giss.nasa.gov/tools/mars24/help/notes.html">Technical
+Notes on Mars Solar Time as Adopted by the Mars24 Sunclock</a> briefly
+describes Mars Coordinated Time (MTC) and the diverse local time
+scales used by each landed mission on Mars.</li>
+<li><a
href="http://hpiers.obspm.fr/eop-pc/products/bulletins/bulletins.html">Bulletins
maintained by the IERS EOP (PC)</a> contains official publications of
the Earth Orientation Parameters Product Center of the
diff --git a/lib/libc/time/zic.8 b/lib/libc/time/zic.8
index 704fb3d79d8..e7b3b78699f 100644
--- a/lib/libc/time/zic.8
+++ b/lib/libc/time/zic.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: zic.8,v 1.16 2004/04/01 11:37:02 jmc Exp $
+.\" $OpenBSD: zic.8,v 1.17 2004/06/28 14:47:41 millert Exp $
.Dd May 23, 1999
.Dt ZIC 8
.Os
@@ -57,6 +57,10 @@ Complain if a year that appears in a data file is outside the range
of years representable by
.Xr time 3
values.
+Also complain if a time of 24:00
+(which cannot be handled by pre-1998 versions of
+.Nm zic )
+appears in the input.
.It Fl y Ar command
Use the given
.Ar command
diff --git a/lib/libc/time/zic.c b/lib/libc/time/zic.c
index 04fe10de796..b813ecd191a 100644
--- a/lib/libc/time/zic.c
+++ b/lib/libc/time/zic.c
@@ -4,8 +4,8 @@
*/
#if defined(LIBC_SCCS) && !defined(lint) && !defined(NOID)
-static char elsieid[] = "@(#)zic.c 7.113";
-static char rcsid[] = "$OpenBSD: zic.c,v 1.22 2004/04/01 11:37:02 jmc Exp $";
+static char elsieid[] = "@(#)zic.c 7.116";
+static char rcsid[] = "$OpenBSD: zic.c,v 1.23 2004/06/28 14:47:41 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include "private.h"
@@ -922,6 +922,8 @@ const int signable;
error(errstring);
return 0;
}
+ if (noise && hh == HOURSPERDAY)
+ warning(_("24:00 not handled by pre-1998 versions of zic"));
return eitol(sign) *
(eitol(hh * MINSPERHOUR + mm) *
eitol(SECSPERMIN) + eitol(ss));
@@ -2141,8 +2143,8 @@ register const int wantedy;
--i;
}
if (i < 0 || i >= len_months[isleap(y)][m]) {
- error(_("no day in month matches rule"));
- (void) exit(EXIT_FAILURE);
+ if (noise)
+ warning(_("rule goes past start/end of month--will not work with pre-2004 versions of zic"));
}
}
if (dayoff < 0 && !TYPE_SIGNED(time_t))
@@ -2234,5 +2236,5 @@ const int i;
}
/*
-** UNIX was a registered trademark of UNIX System Laboratories in 1993.
+** UNIX was a registered trademark of The Open Group in 2003.
*/