summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2000-09-06 23:05:13 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2000-09-06 23:05:13 +0000
commit953afaad68de00e2fc68be4f909cde6f4c3f27db (patch)
treec0715298e4de812f4bc9081a4fb03e3251732323 /lib/libc
parent9cbbd593a1c111fc16f9851249f2c4991d60a85e (diff)
Update to tzcode2000f from ftp://elsie.nci.nih.gov/pub/
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/time/private.h22
-rw-r--r--lib/libc/time/strftime.319
-rw-r--r--lib/libc/time/strftime.c83
-rw-r--r--lib/libc/time/tz-art.htm19
-rw-r--r--lib/libc/time/tz-link.htm45
-rw-r--r--lib/libc/time/zic.c4
6 files changed, 155 insertions, 37 deletions
diff --git a/lib/libc/time/private.h b/lib/libc/time/private.h
index 82cfeacc91d..7fa953fd133 100644
--- a/lib/libc/time/private.h
+++ b/lib/libc/time/private.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: private.h,v 1.12 2000/04/16 16:24:04 d Exp $ */
+/* $OpenBSD: private.h,v 1.13 2000/09/06 23:05:11 millert Exp $ */
#ifndef PRIVATE_H
#define PRIVATE_H
@@ -33,7 +33,7 @@
#if 0
#ifndef lint
#ifndef NOID
-static char privatehid[] = "@(#)private.h 7.49";
+static char privatehid[] = "@(#)private.h 7.51";
#endif /* !defined NOID */
#endif /* !defined lint */
#endif
@@ -51,12 +51,16 @@ static char privatehid[] = "@(#)private.h 7.49";
#define HAVE_GETTEXT 0
#endif /* !defined HAVE_GETTEXT */
+#ifndef HAVE_INCOMPATIBLE_CTIME_R
+#define HAVE_INCOMPATIBLE_CTIME_R 0
+#endif /* !defined INCOMPATIBLE_CTIME_R */
+
#ifndef HAVE_SETTIMEOFDAY
#define HAVE_SETTIMEOFDAY 3
#endif /* !defined HAVE_SETTIMEOFDAY */
#ifndef HAVE_STRERROR
-#define HAVE_STRERROR 0
+#define HAVE_STRERROR 1
#endif /* !defined HAVE_STRERROR */
#ifndef HAVE_SYMLINK
@@ -81,6 +85,11 @@ static char privatehid[] = "@(#)private.h 7.49";
#endif /* !defined LOCALE_HOME */
#endif
+#if HAVE_INCOMPATIBLE_CTIME_R
+#define asctime_r _incompatible_asctime_r
+#define ctime_r _incompatible_ctime_r
+#endif /* HAVE_INCOMPATIBLE_CTIME_R */
+
/*
** Nested includes
*/
@@ -294,6 +303,13 @@ char * scheck P((const char *string, const char *format));
#define TZ_DOMAIN "tz"
#endif /* !defined TZ_DOMAIN */
+#if HAVE_INCOMPATIBLE_CTIME_R
+#undef asctime_r
+#undef ctime_r
+char *asctime_r P((struct tm const *, char *));
+char *ctime_r P((time_t const *, char *));
+#endif /* HAVE_INCOMPATIBLE_CTIME_R */
+
/*
** UNIX was a registered trademark of UNIX System Laboratories in 1993.
*/
diff --git a/lib/libc/time/strftime.3 b/lib/libc/time/strftime.3
index 3383ffc3acd..eee1d0bbc9c 100644
--- a/lib/libc/time/strftime.3
+++ b/lib/libc/time/strftime.3
@@ -34,7 +34,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)strftime.3 5.12 (Berkeley) 6/29/91
-.\" $OpenBSD: strftime.3,v 1.10 2000/04/16 16:24:04 d Exp $
+.\" $OpenBSD: strftime.3,v 1.11 2000/09/06 23:05:11 millert Exp $
.\"
.Dd January 18, 1998
.Dt STRFTIME 3
@@ -81,7 +81,7 @@ follows which are then copied into the buffer.
.Bl -tag -width "xxxx"
.It Cm \&%A
is replaced by the locale's full weekday name.
-.It Cm %a
+.It Cm \&%a
is replaced by the locale's abbreviated weekday name.
.It Cm \&%B
is replaced by the locale's full month name.
@@ -100,6 +100,9 @@ is replaced by the day of the month as a decimal number (01-31).
.It Cm \&%e
is replaced by the day of month as a decimal number (1-31);
single digits are preceded by a blank.
+.It Cm \&%F
+is replaced by the date in the format
+.Dq Li %Y-%m-%d .
.It Cm \&%G
is replaced by the ISO 8601 year with century as a decimal number.
.It Cm \&%g
@@ -169,7 +172,15 @@ is replaced by the year with century as a decimal number.
.It Cm \&%y
is replaced by the year without century as a decimal number (00-99).
.It Cm \&%Z
-is replaced by the time zone name.
+is replaced by the time zone name,
+or by the empty string if this is not determinable.
+.It Cm \&%z
+is replaced by the offset from UTC in the format
+.Dq Li +HHMM
+or
+.Dq Li -HHMM
+as appropriate, with positive values representing locations east
+of Greenwich, or by the empty string if this is not determinable.
.It Cm %%
is replaced by
.Ql % .
@@ -225,4 +236,4 @@ other implementations may not do so when
is not large enough to store the entire time string. The contents of
.Fa buf
are implementation specific in this case.
-.\" @(#)newstrftime.3 7.11
+.\" @(#)newstrftime.3 7.14
diff --git a/lib/libc/time/strftime.c b/lib/libc/time/strftime.c
index f005a86a936..54270afa5d7 100644
--- a/lib/libc/time/strftime.c
+++ b/lib/libc/time/strftime.c
@@ -1,6 +1,6 @@
#if defined(LIBC_SCCS) && !defined(lint) && !defined(NOID)
-static char elsieid[] = "@(#)strftime.c 7.58";
-static char *rcsid = "$OpenBSD: strftime.c,v 1.6 2000/04/16 16:24:04 d Exp $";
+static char elsieid[] = "@(#)strftime.c 7.62";
+static char *rcsid = "$OpenBSD: strftime.c,v 1.7 2000/09/06 23:05:11 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include "private.h"
@@ -236,20 +236,21 @@ label:
case 'E':
case 'O':
/*
- ** POSIX locale extensions, a la
- ** Arnold Robbins' strftime version 3.0.
+ ** C99 locale modifiers.
** The sequences
- ** %Ec %EC %Ex %Ey %EY
+ ** %Ec %EC %Ex %EX %Ey %EY
** %Od %oe %OH %OI %Om %OM
** %OS %Ou %OU %OV %Ow %OW %Oy
** are supposed to provide alternate
** representations.
- ** (ado, 1993-05-24)
*/
goto label;
case 'e':
pt = _conv(t->tm_mday, "%2d", pt, ptlim);
continue;
+ case 'F':
+ pt = _fmt("%Y-%m-%d", t, pt, ptlim, warnp);
+ continue;
case 'H':
pt = _conv(t->tm_hour, "%02d", pt, ptlim);
continue;
@@ -492,10 +493,66 @@ label:
pt = _add(t->TM_ZONE, pt, ptlim);
else
#endif /* defined TM_ZONE */
- if (t->tm_isdst == 0 || t->tm_isdst == 1) {
- pt = _add(tzname[t->tm_isdst],
+ if (t->tm_isdst >= 0)
+ pt = _add(tzname[t->tm_isdst != 0],
pt, ptlim);
- } else pt = _add("?", pt, ptlim);
+ /*
+ ** C99 says that %Z must be replaced by the
+ ** empty string if the time zone is not
+ ** determinable.
+ */
+ continue;
+ case 'z':
+ {
+ int diff;
+ char const * sign;
+
+ if (t->tm_isdst < 0)
+ continue;
+#ifdef TM_GMTOFF
+ diff = t->TM_GMTOFF;
+#else /* !defined TM_GMTOFF */
+ /*
+ ** C99 says that the UTC offset must
+ ** be computed by looking only at
+ ** tm_isdst. This requirement is
+ ** incorrect, since it means the code
+ ** must rely on magic (in this case
+ ** altzone and timezone), and the
+ ** magic might not have the correct
+ ** offset. Doing things correctly is
+ ** tricky and requires disobeying C99;
+ ** see GNU C strftime for details.
+ ** For now, punt and conform to the
+ ** standard, even though it's incorrect.
+ **
+ ** C99 says that %z must be replaced by the
+ ** empty string if the time zone is not
+ ** determinable, so output nothing if the
+ ** appropriate variables are not available.
+ */
+ if (t->tm_isdst == 0)
+#ifdef USG_COMPAT
+ diff = -timezone;
+#else /* defined USG_COMPAT */
+ continue;
+#endif /* !defined USG_COMPAT */
+ else
+#ifdef ALTZONE
+ diff = -altzone;
+#else /* !defined ALTZONE */
+ continue;
+#endif /* !defined ALTZONE */
+#endif /* !defined TM_GMTOFF */
+ if (diff < 0) {
+ sign = "-";
+ diff = -diff;
+ } else sign = "+";
+ pt = _add(sign, pt, ptlim);
+ diff /= 60;
+ pt = _conv((diff/60)*100 + diff%60,
+ "%04d", pt, ptlim);
+ }
continue;
case '+':
pt = _fmt(Locale->date_fmt, t, pt, ptlim,
@@ -503,10 +560,10 @@ label:
continue;
case '%':
/*
- * X311J/88-090 (4.12.3.5): if conversion char is
- * undefined, behavior is undefined. Print out the
- * character itself as printf(3) also does.
- */
+ ** X311J/88-090 (4.12.3.5): if conversion char is
+ ** undefined, behavior is undefined. Print out the
+ ** character itself as printf(3) also does.
+ */
default:
break;
}
diff --git a/lib/libc/time/tz-art.htm b/lib/libc/time/tz-art.htm
index e1b2882793e..aba7d2f989c 100644
--- a/lib/libc/time/tz-art.htm
+++ b/lib/libc/time/tz-art.htm
@@ -1,5 +1,5 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<!-- $OpenBSD: tz-art.htm,v 1.1 2000/04/16 16:24:04 d Exp $ -->
+<!-- $OpenBSD: tz-art.htm,v 1.2 2000/09/06 23:05:11 millert Exp $ -->
<HTML>
<HEAD>
<TITLE>Time and the Arts</TITLE>
@@ -7,7 +7,7 @@
<BODY>
<H1>Time and the Arts</H1>
<ADDRESS>
-@(#)tz-art.htm 7.33
+@(#)tz-art.htm 7.37
</ADDRESS>
<P>
Please send corrections to this web page to the
@@ -176,7 +176,7 @@ Notes: Wall-clock time plays a central role in the plot.
Film: Bell Science - About Time
Notes: The Frank Baxter/Richard Deacon extravaganza
Information on ordering is available at
- <A HREF="http://www.videoflicks.com/VF/38/038332.htm">http://www.videoflicks.com/VF/38/038332.htm</A>
+ <A HREF="http://www.videoflicks.com/VF2/1035/1035893.ihtml">http://www.videoflicks.com/VF2/1035/1035893.ihtml</A>
--------------------------------------------------------------------------
An episode of "The Adventures of Superman" entitled "The Mysterious
Cube," first aired 1958-02-24, had Superman convincing the controllers
@@ -189,12 +189,25 @@ entitled "The Chimes of Big Ben" in which our protagonist tumbled to
the fraudulent nature of a Poland-to-England escape upon hearing "Big
Ben" chiming on Polish local time.
--------------------------------------------------------------------------
+The series "Seinfeld" included an episode entitled "The Susie," first
+broadcast 1997-02-13, in which Kramer decides that daylight saving time
+isn't coming fast enough, so he sets his watch ahead an hour.
+--------------------------------------------------------------------------
The syndicated comic strip "Dilbert" featured an all-too-rare example of
time zone humor on 1998-03-14.
--------------------------------------------------------------------------
Surrealist artist Guy Billout's work "Date Line" appeared on page 103
of the November, 1999 Atlantic Monthly.
+--------------------------------------------------------------------------
+"In what time zone would you find New York City?" was a $200 question on
+the 1999-11-13 United States airing of "Who Wants to be a Millionaire?"
==========================================================================
+"A fundamental belief held by Americans is that if you are on land, you
+cannot be killed by a fish...So most Americans remain on land, believing
+they're safe. Unfortunately, this belief--like so many myths, such as that
+there's a reason for 'Daylight Saving Time'--is false."
+ Dave Barry column, 2000-07-02
+--------------------------------------------------------------------------
"Good news."
"What did they do? Extend Daylight Saving Time year round?"
Professional tanner George Hamilton, in dialog from a
diff --git a/lib/libc/time/tz-link.htm b/lib/libc/time/tz-link.htm
index fe3c981a2cd..549efa92886 100644
--- a/lib/libc/time/tz-link.htm
+++ b/lib/libc/time/tz-link.htm
@@ -1,12 +1,12 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<!-- $OpenBSD: tz-link.htm,v 1.1 2000/04/16 16:24:04 d Exp $ -->
+<!-- $OpenBSD: tz-link.htm,v 1.2 2000/09/06 23:05:12 millert Exp $ -->
<HTML>
<HEAD>
<TITLE>Sources for Time Zone and Daylight Saving Time Data</TITLE>
<LINK REL="schema.DC" HREF="http://purl.org/DC/elements/1.1/">
<META NAME="DC.Creator" CONTENT="Paul Eggert">
<META NAME="DC.Contributor" CONTENT="Arthur David Olson">
-<META NAME="DC.Date" CONTENT="2000/03/04">
+<META NAME="DC.Date" CONTENT="2000/08/10">
<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">
@@ -16,7 +16,7 @@
<BODY>
<H1>Sources for Time Zone and Daylight Saving Time Data</H1>
<ADDRESS>
-@(#)tz-link.htm 7.25
+@(#)tz-link.htm 7.27
</ADDRESS>
<P>
Please send corrections to this web page to the
@@ -37,6 +37,9 @@ the code is in the file <samp>tzcode<var>C</var>.tar.gz</samp>,
where <samp><var>C</var></samp> is the code's version;
similarly, the data are in <samp>tzdata<var>D</var>.tar.gz</samp>,
where <samp><var>D</var></samp> is the data's version.
+The code lets you compile the text data into time zone files, one for
+each location. It also lets you read a compiled time zone file and
+interpret time stamps for that location.
<P>
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
@@ -47,12 +50,6 @@ HREF="ftp://elsie.nci.nih.gov/pub/tzarchive.gz">archive of old
messages</A> (in <A HREF="http://www.gzip.org/">gzip</A> compressed
format).
<P>
-The <A HREF="http://www.gnu.org/software/libc/">GNU C Library</A>
-has an independent, thread-safe implementation of
-a time zone file reader that is compatible with <samp>tz</samp>.
-This library is freely available under the GNU Library General Public License,
-and is widely used in GNU/Linux systems.
-<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.
<H2>Web pages using recent versions of the <samp>tz</samp> database</H2>
@@ -70,10 +67,25 @@ is a fancier web interface.
is an even fancier interface.
<LI><A HREF="http://www.burbs.com/fcgi-bin/tzconvert.fcgi">Burbs time
zone converter</A> is a multilingual interface.
+<LI><A HREF="http://www.holidayfestival.com/">The Worldwide Holiday
+&amp; Festival Site</A> lists DST-related clock changes along with holidays.
<LI><A HREF="http://www.timeanddate.com/worldclock/">The World Clock</A>
is a web interface to a time zone database derived from
<samp>tz</samp>'s.
</UL>
+<H2>Other time zone file readers</H2>
+<UL>
+<LI>The <A HREF="http://www.gnu.org/software/libc/">GNU C Library</A>
+has an independent, thread-safe implementation of
+a time zone file reader that is compatible with <samp>tz</samp>.
+This library is freely available under the
+<A HREF="http://www.gnu.org/copyleft/lesser.html">
+GNU Lesser General Public License (LGPL)</A>,
+and is widely used in GNU/Linux systems.
+<LI><A HREF="http://www.bmsi.com/java/#TZ">ZoneInfo.java</A>
+is a time zone file reader written in Java.
+It is freely available under the GNU LGPL.
+</UL>
<H2>Other <SAMP>tz</SAMP>-based time zone conversion software</H2>
<UL>
<LI><A
@@ -86,9 +98,10 @@ Microsoft Windows 95/98/NT4 program.
<H2>Other time zone databases</H2>
<UL>
<LI><A HREF="http://www.astro.ch/atlas/">Astrology / Astrologie -&gt;
-Astrodienst Atlas Database</A> is Astrodienst's Web version of <A
-HREF="http://astrocom.com/books/xrefa.htm#SHANKS">Shanks's
-excellent time zone history atlases</A> published by <A
+Astrodienst Atlas Database</A> is Astrodienst's Web version of Shanks's
+excellent time zone history atlases published in both <A
+HREF="http://astrocom.com/software/ACS_PC_Atlas.htm">computer</A> and <A
+HREF="http://astrocom.com/books/xrefa.htm#SHANKS">book</A> form by <A
HREF="http://astrocom.com/">Astro Communications Services</A>.
<LI><A HREF="http://worldtime.com/">WORLDTIME: interactive atlas,
time info, public holidays</A>
@@ -175,6 +188,14 @@ briefly explains interplanetary space flight timekeeping.
of IERS</A> contains official publications of the
International Earth Rotation Service, the committee that decides
when leap seconds occur.
+<LI>The <A
+HREF="http://clockdev.usno.navy.mil/archives/leapsecs.html">Leap
+Second Discussion List</A> covers <A
+HREF="http://www.gisdevelopment.net/reference/scie/s_t_41_50.htm#47">McCarthy
+and Klepczynski's proposal to remove leap seconds</A>, currently
+being studied by a <A
+HREF="http://www.intec.rug.ac.be/Research/Projects/ursi/Commissions.html">URSI
+Commission J</A> working group.
</UL>
<H2>Time notation</H2>
<UL>
diff --git a/lib/libc/time/zic.c b/lib/libc/time/zic.c
index 57a37c95616..23ccf3bbef8 100644
--- a/lib/libc/time/zic.c
+++ b/lib/libc/time/zic.c
@@ -1,6 +1,6 @@
#if defined(LIBC_SCCS) && !defined(lint) && !defined(NOID)
-static char elsieid[] = "@(#)zic.c 7.100";
-static char rcsid[] = "$OpenBSD: zic.c,v 1.14 2000/08/05 20:53:38 deraadt Exp $";
+static char elsieid[] = "@(#)zic.c 7.101";
+static char rcsid[] = "$OpenBSD: zic.c,v 1.15 2000/09/06 23:05:12 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include "private.h"