diff options
-rw-r--r-- | lib/libc/time/README | 6 | ||||
-rw-r--r-- | lib/libc/time/Theory | 16 | ||||
-rw-r--r-- | lib/libc/time/asctime.c | 7 | ||||
-rw-r--r-- | lib/libc/time/ctime.3 | 8 | ||||
-rw-r--r-- | lib/libc/time/ialloc.c | 4 | ||||
-rw-r--r-- | lib/libc/time/localtime.c | 47 | ||||
-rw-r--r-- | lib/libc/time/strftime.3 | 6 | ||||
-rw-r--r-- | lib/libc/time/time2posix.3 | 6 | ||||
-rw-r--r-- | lib/libc/time/tz-art.htm | 96 | ||||
-rw-r--r-- | lib/libc/time/tz-link.htm | 54 | ||||
-rw-r--r-- | lib/libc/time/tzfile.5 | 6 | ||||
-rw-r--r-- | lib/libc/time/tzset.3 | 8 | ||||
-rw-r--r-- | lib/libc/time/zdump.8 | 8 | ||||
-rw-r--r-- | lib/libc/time/zdump.c | 27 | ||||
-rw-r--r-- | lib/libc/time/zic.8 | 11 | ||||
-rw-r--r-- | lib/libc/time/zic.c | 28 |
16 files changed, 233 insertions, 105 deletions
diff --git a/lib/libc/time/README b/lib/libc/time/README index 285b152dd72..f02a6562143 100644 --- a/lib/libc/time/README +++ b/lib/libc/time/README @@ -1,5 +1,7 @@ -$OpenBSD: README,v 1.7 2008/03/31 14:16:53 millert Exp $ -@(#)README 8.2 +$OpenBSD: README,v 1.8 2010/08/23 22:35:34 millert Exp $ +@(#)README 8.3 +This file is in the public domain, so clarified as of +2009-05-17 by Arthur David Olson. "What time is it?" -- Richard Deacon as The King "Any time you want it to be." -- Frank Baxter as The Scientist diff --git a/lib/libc/time/Theory b/lib/libc/time/Theory index d5a9f5092c4..d40ed4468b1 100644 --- a/lib/libc/time/Theory +++ b/lib/libc/time/Theory @@ -1,6 +1,7 @@ -$OpenBSD: Theory,v 1.13 2007/06/30 13:20:42 millert Exp $ -@(#)Theory 8.2 - +$OpenBSD: Theory,v 1.14 2010/08/23 22:35:34 millert Exp $ +@(#)Theory 8.4 +This file is in the public domain, so clarified as of +2009-05-17 by Arthur David Olson. ----- Outline ----- @@ -10,7 +11,6 @@ $OpenBSD: Theory,v 1.13 2007/06/30 13:20:42 millert Exp $ Calendrical issues Time and time zones on Mars - ----- Time and date functions ----- These time and date functions are upwards compatible with POSIX, @@ -361,10 +361,10 @@ abbreviations like `EST'; this avoids the ambiguity. 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. diff --git a/lib/libc/time/asctime.c b/lib/libc/time/asctime.c index f05a428aef7..4c7c9237003 100644 --- a/lib/libc/time/asctime.c +++ b/lib/libc/time/asctime.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asctime.c,v 1.15 2007/02/06 19:35:16 millert Exp $ */ +/* $OpenBSD: asctime.c,v 1.16 2010/08/23 22:35:34 millert Exp $ */ /* ** This file is in the public domain, so clarified as of ** 1996-06-05 by Arthur David Olson. @@ -82,6 +82,11 @@ int bufsize; char year[INT_STRLEN_MAXIMUM(int) + 2]; int len; + if (timeptr == NULL) { + errno = EINVAL; + strlcpy(buf, "??? ??? ?? ??:??:?? ????\n", bufsize); + return buf; + } if (timeptr->tm_wday < 0 || timeptr->tm_wday >= DAYSPERWEEK) wn = "???"; else wn = wday_name[timeptr->tm_wday]; diff --git a/lib/libc/time/ctime.3 b/lib/libc/time/ctime.3 index 13cb5530699..37a175dd393 100644 --- a/lib/libc/time/ctime.3 +++ b/lib/libc/time/ctime.3 @@ -1,7 +1,7 @@ -.\" $OpenBSD: ctime.3,v 1.36 2008/10/23 20:33:06 guenther Exp $ +.\" $OpenBSD: ctime.3,v 1.37 2010/08/23 22:35:34 millert Exp $ .\" .\" -.Dd $Mdocdate: October 23 2008 $ +.Dd $Mdocdate: August 23 2010 $ .Dt CTIME 3 .Os .Sh NAME @@ -316,6 +316,6 @@ as the superuser. Avoid using out-of-range values with .Fn mktime when setting up lunch with promptness sticklers in Riyadh. -.\" based on @(#)newctime.3 8.2 +.\" based on @(#)newctime.3 8.3 .\" This file is in the public domain, so clarified as of -.\" 2003-02-14 by Arthur David Olson (arthur_david_olson@nih.gov). +.\" 2009-05-17 by Arthur David Olson. diff --git a/lib/libc/time/ialloc.c b/lib/libc/time/ialloc.c index 1a110dd2bec..a1c3910515a 100644 --- a/lib/libc/time/ialloc.c +++ b/lib/libc/time/ialloc.c @@ -1,7 +1,7 @@ -/* $OpenBSD: ialloc.c,v 1.11 2007/06/30 13:20:42 millert Exp $ */ +/* $OpenBSD: ialloc.c,v 1.12 2010/08/23 22:35:34 millert Exp $ */ /* ** This file is in the public domain, so clarified as of -** Feb 14, 2003 by Arthur David Olson (arthur_david_olson@nih.gov). +** 2006-07-17 by Arthur David Olson. */ /*LINTLIBRARY*/ diff --git a/lib/libc/time/localtime.c b/lib/libc/time/localtime.c index 8b4dc80dfa7..0471d0a25f1 100644 --- a/lib/libc/time/localtime.c +++ b/lib/libc/time/localtime.c @@ -1,4 +1,4 @@ -/* $OpenBSD: localtime.c,v 1.34 2008/03/31 14:16:53 millert Exp $ */ +/* $OpenBSD: localtime.c,v 1.35 2010/08/23 22:35:34 millert Exp $ */ /* ** This file is in the public domain, so clarified as of ** 1996-06-05 by Arthur David Olson. @@ -272,34 +272,28 @@ settzname(void) return; } #endif /* defined ALL_STATE */ - for (i = 0; i < sp->typecnt; ++i) { - register const struct ttinfo * const ttisp = &sp->ttis[i]; + /* + ** 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]; #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 - if (i == 0 || ttisp->tt_isdst) + if (ttisp->tt_isdst) 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]; - } - /* ** Finally, scrub the abbreviations. ** First, replace bogus characters. */ @@ -348,6 +342,7 @@ register const int doextend; 4 * TZ_MAX_TIMES]; } u; + sp->goback = sp->goahead = FALSE; if (name != NULL && issetugid() != 0) if ((name[0] == ':' && (strchr(name, '/') || strstr(name, ".."))) || name[0] == '/' || strchr(name, '.')) @@ -557,7 +552,6 @@ register const int doextend; sp->ttis[sp->typecnt++] = ts.ttis[1]; } } - sp->goback = sp->goahead = FALSE; if (sp->timecnt > 1) { for (i = 1; i < sp->timecnt; ++i) if (typesequiv(sp, sp->types[i], sp->types[0]) && @@ -1156,7 +1150,7 @@ tzsetwall_basic(void) #ifdef ALL_STATE if (lclptr == NULL) { - lclptr = (struct state *) malloc(sizeof *lclptr); + lclptr = (struct state *) calloc(1, sizeof *lclptr); if (lclptr == NULL) { settzname(); /* all we can do */ return; @@ -1203,7 +1197,7 @@ tzset_basic(void) #ifdef ALL_STATE if (lclptr == NULL) { - lclptr = (struct state *) malloc(sizeof *lclptr); + lclptr = (struct state *) calloc(1, sizeof *lclptr); if (lclptr == NULL) { settzname(); /* all we can do */ return; @@ -1381,7 +1375,7 @@ struct tm * const tmp; if (!gmt_is_set) { gmt_is_set = TRUE; #ifdef ALL_STATE - gmtptr = (struct state *) malloc(sizeof *gmtptr); + gmtptr = (struct state *) calloc(1, sizeof *gmtptr); if (gmtptr != NULL) #endif /* defined ALL_STATE */ gmtload(gmtptr); @@ -1923,6 +1917,10 @@ const long offset; 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(tmp, funcp, offset, &okay); @@ -1999,7 +1997,8 @@ time_t timelocal(tmp) 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); } @@ -2007,7 +2006,8 @@ time_t timegm(tmp) struct tm * const tmp; { - tmp->tm_isdst = 0; + if (tmp != NULL) + tmp->tm_isdst = 0; return time1(tmp, gmtsub, 0L); } @@ -2016,7 +2016,8 @@ timeoff(tmp, offset) struct tm * const tmp; const long offset; { - tmp->tm_isdst = 0; + if (tmp != NULL) + tmp->tm_isdst = 0; return time1(tmp, gmtsub, offset); } diff --git a/lib/libc/time/strftime.3 b/lib/libc/time/strftime.3 index 9743965e00c..f165945feeb 100644 --- a/lib/libc/time/strftime.3 +++ b/lib/libc/time/strftime.3 @@ -30,9 +30,9 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)strftime.3 5.12 (Berkeley) 6/29/91 -.\" $OpenBSD: strftime.3,v 1.23 2009/09/09 06:38:25 jmc Exp $ +.\" $OpenBSD: strftime.3,v 1.24 2010/08/23 22:35:34 millert Exp $ .\" -.Dd $Mdocdate: September 9 2009 $ +.Dd $Mdocdate: August 23 2010 $ .Dt STRFTIME 3 .Os .Sh NAME @@ -245,4 +245,4 @@ is not large enough to store the entire time string. The contents of .Fa buf are implementation specific in this case. -.\" @(#)newstrftime.3 8.1 +.\" @(#)newstrftime.3 8.2 diff --git a/lib/libc/time/time2posix.3 b/lib/libc/time/time2posix.3 index 9f28fc6a82e..cd6170cd809 100644 --- a/lib/libc/time/time2posix.3 +++ b/lib/libc/time/time2posix.3 @@ -1,5 +1,5 @@ -.\" $OpenBSD: time2posix.3,v 1.16 2010/01/03 13:24:09 schwarze Exp $ -.Dd $Mdocdate: January 3 2010 $ +.\" $OpenBSD: time2posix.3,v 1.17 2010/08/23 22:35:34 millert Exp $ +.Dd $Mdocdate: August 23 2010 $ .Dt TIME2POSIX 3 .Os .Sh NAME @@ -138,6 +138,6 @@ degenerate to the identity function. .Xr localtime 3 , .Xr mktime 3 , .Xr time 3 -.\" @(#)time2posix.3 8.1 +.\" @(#)time2posix.3 8.2 .\" This file is in the public domain, so clarified as of .\" 1996-06-05 by Arthur David Olson. diff --git a/lib/libc/time/tz-art.htm b/lib/libc/time/tz-art.htm index ba5225acf5c..ff2afa90624 100644 --- a/lib/libc/time/tz-art.htm +++ b/lib/libc/time/tz-art.htm @@ -9,9 +9,13 @@ PUBLIC "-//W3C//DTD HTML 4.01//EN" <body> <h1>Time and the Arts</h1> <address> -@(#)tz-art.htm 8.10 +@(#)tz-art.htm 8.17 </address> <p> +This file is in the public domain, so clarified as of +2009-05-17 by Arthur David Olson. +</p> +<p> Please send corrections to this web page to the <a href="mailto:tz@elsie.nci.nih.gov">time zone mailing list</a>.</p> <p> @@ -202,6 +206,42 @@ Barker, Kim Williams and Rob Harbin and performed by Doug Supernaw.</td></tr> <tr><td> </td></tr> +<tr><td>Artist</td><td>The Microscopic Septet</td></tr> +<tr><td>CD</td><td>Lobster Leaps In</td></tr> +<tr><td>Copyright Date</td><td>2008</td></tr> +<tr><td>Label</td><td>Cuneiform</td></tr> +<tr><td>ID</td><td>272</td></tr> +<tr><td>Total Time</td><td>73:05</td></tr> +<tr><td>Notes</td><td>Includes the song "Twilight Time Zone."</td></tr> +<tr><td><a href="http://www.allmusic.com/cg/amg.dll?p=amg&sql=10:w9fpxzykldje">AMG Rating</a></td><td>3.5 stars</td></tr> +<tr><td>ADO Rating</td><td>2 stars</td></tr> + +<tr><td> </td></tr> + +<tr><td>Artist</td><td>Bob Dylan</td></tr> +<tr><td>CD</td><td>The Time They Are A-Changin'</td></tr> +<tr><td>Copyright Date</td><td>1964</td></tr> +<tr><td>Label</td><td>Columbia</td></tr> +<tr><td>ID</td><td>CK-8905</td></tr> +<tr><td>Total Time</td><td>45:36</td></tr> +<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> </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> </td></tr> + <tr><td>TV episode title</td><td>The Lost Hour</td> <tr><td>TV series</td><td><em>Eerie, Indiana</em></td> <tr><td>TV episode number</td><td>10</td> @@ -325,6 +365,48 @@ A private jet's mid-flight change of time zones distorts Alison Dubois' premonition in the "We Had a Dream" episode of "Medium" (originally aired 2007-02-28). </li> +<li> +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 +characters was supposed to have died (but didn't). +The IMDb page is at +<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> </ul> <hr> <ul> @@ -335,6 +417,18 @@ Now that's pretty near 100 years, daylight savings [sic]." 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 diff --git a/lib/libc/time/tz-link.htm b/lib/libc/time/tz-link.htm index d71de32e577..26235100b98 100644 --- a/lib/libc/time/tz-link.htm +++ b/lib/libc/time/tz-link.htm @@ -18,9 +18,13 @@ <body> <h1>Sources for Time Zone and Daylight Saving Time Data</h1> <address> -@(#)tz-link.htm 8.16 +@(#)tz-link.htm 8.30 </address> <p> +This file is in the public domain, so clarified as of +2009-05-17 by Arthur David Olson. +</p> +<p> Please send corrections to this web page to the <a href="mailto:tz@elsie.nci.nih.gov">time zone mailing list</a>.</p> <h2>The <code>tz</code> database</h2> @@ -36,8 +40,8 @@ href="http://en.wikipedia.org/wiki/Coordinated_Universal_Time"><abbr 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 @@ -85,6 +89,8 @@ the code is in the file <code>tzcode<var>C</var>.tar.gz</code>, 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; @@ -110,10 +116,7 @@ retrieve the <a href="ftp://elsie.nci.nih.gov/pub/tzarchive.gz">full archive of old messages</a> (in gzip compressed format), or retrieve <a href="ftp://munnari.oz.au/pub/oldtz">archived older versions of code -and data</a>; there is also a smaller <a -href="http://public.planetmirror.com/pub/timezone"><abbr -title="Hypertext Transfer Protocol">HTTP</abbr> -mirror</a>.</p> +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. @@ -123,6 +126,14 @@ Here are some recent links that may be of interest. 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 @@ -140,6 +151,9 @@ difference versus time for any pair of locations.</li> <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> @@ -218,7 +232,7 @@ 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 <abbr>BSD</abbr>-style license.</li> -<li><a href="http://sourceforge.net/projects/pytz">PyTZ - Python Time +<li><a href="http://pytz.sourceforge.net">PyTZ - Python Time Zone Library</a> compiles <code>tz</code> source into <a href="http://python.org/">Python</a>. It is freely available under a <abbr>BSD</abbr>-style license.</li> @@ -296,6 +310,12 @@ licenses</a> to <code>tz</code> contributors.</li> <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> </ul> <h2>Other time zone databases</h2> <ul> @@ -331,6 +351,17 @@ href="http://unicode.org/cldr/data/diff/supplemental/windows_tzid.html">Windows → 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> @@ -356,10 +387,9 @@ but the maps are more up to date.</li> </ul> <h2>Time zone boundaries</h2> <ul> -<li><a href="http://efele.net/maps/tz/us/">A map of the TZ timezones in -the US</a> contains a <a +<li><a href="http://efele.net/maps/tz/">TZ timezone maps</a> contains a <a href="http://en.wikipedia.org/wiki/Shapefile">shapefile</a> of the -<code>tz</code> regions in the US.</li> +<code>tz</code> regions in the world.</li> <li><a href="http://statoids.com/statoids.html">Administrative Divisions of Countries ("Statoids")</a> contains detailed lists of <code>tz</code>-related zone subdivision data.</li> @@ -555,7 +585,7 @@ and Klepczynski's proposal to discontinue leap seconds</a>, discussed further in <a href="http://www.cl.cam.ac.uk/~mgk25/time/metrologia-leapsecond.pdf">The leap second: its history and possible future</a>. -The <a href="http://aas.org/policy/LeapSecondCommittee.html"><abbr +The (now disbanded) <a href="http://members.aas.org/comms/leap.cfm"><abbr title="American Astronomical Society">AAS</abbr> Leap Second Committee</a> has solicited input on this proposal. <a href="http://www.ucolick.org/~sla/leapsecs/">The diff --git a/lib/libc/time/tzfile.5 b/lib/libc/time/tzfile.5 index 21e5b495d05..2f89b3b3e6a 100644 --- a/lib/libc/time/tzfile.5 +++ b/lib/libc/time/tzfile.5 @@ -1,5 +1,5 @@ -.\" $OpenBSD: tzfile.5,v 1.12 2008/01/07 01:09:37 millert Exp $ -.Dd $Mdocdate: January 7 2008 $ +.\" $OpenBSD: tzfile.5,v 1.13 2010/08/23 22:35:34 millert Exp $ +.Dd $Mdocdate: August 23 2010 $ .Dt TZFILE 5 .Os .Sh NAME @@ -150,6 +150,6 @@ after the last transition time stored in the file such instants). .Sh SEE ALSO .Xr ctime 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. diff --git a/lib/libc/time/tzset.3 b/lib/libc/time/tzset.3 index 29ef7142b9d..c634cc0ac3b 100644 --- a/lib/libc/time/tzset.3 +++ b/lib/libc/time/tzset.3 @@ -1,5 +1,5 @@ -.\" $OpenBSD: tzset.3,v 1.17 2007/05/31 19:19:34 jmc Exp $ -.Dd $Mdocdate: May 31 2007 $ +.\" $OpenBSD: tzset.3,v 1.18 2010/08/23 22:35:34 millert Exp $ +.Dd $Mdocdate: August 23 2010 $ .Dt TZSET 3 .Os .Sh NAME @@ -286,6 +286,6 @@ UTC leap seconds are loaded from .Xr strftime 3 , .Xr time 3 , .Xr tzfile 5 -.\" @(#)newtzset.3 8.1 +.\" @(#)newtzset.3 8.2 .\" This file is in the public domain, so clarified as of -.\" 2003-02-14 by Arthur David Olson. +.\" 2009-05-17 by Arthur David Olson. diff --git a/lib/libc/time/zdump.8 b/lib/libc/time/zdump.8 index 215cc05d34b..3fc4a25eb65 100644 --- a/lib/libc/time/zdump.8 +++ b/lib/libc/time/zdump.8 @@ -1,5 +1,5 @@ -.\" $OpenBSD: zdump.8,v 1.14 2007/05/31 19:19:34 jmc Exp $ -.Dd $Mdocdate: May 31 2007 $ +.\" $OpenBSD: zdump.8,v 1.15 2010/08/23 22:35:34 millert Exp $ +.Dd $Mdocdate: August 23 2010 $ .Dt ZDUMP 8 .Os .Sh NAME @@ -59,6 +59,6 @@ This works in all real-world cases; .Xr ctime 3 , .Xr tzfile 5 , .Xr zic 8 -.\" @(#)zdump.8 7.7 +.\" @(#)zdump.8 8.2 .\" This file is in the public domain, so clarified as of -.\" 2003-02-14 by Arthur David Olson. +.\" 2009-05-17 by Arthur David Olson. diff --git a/lib/libc/time/zdump.c b/lib/libc/time/zdump.c index a7c72bbb8fb..02a986ec3e0 100644 --- a/lib/libc/time/zdump.c +++ b/lib/libc/time/zdump.c @@ -1,8 +1,8 @@ -/* $OpenBSD: zdump.c,v 1.21 2007/12/29 22:26:51 millert Exp $ */ +/* $OpenBSD: zdump.c,v 1.22 2010/08/23 22:35:34 millert Exp $ */ /* ** This file is in the public domain, so clarified as of -** Feb 14, 2003 by Arthur David Olson. -static char elsieid[] = "@(#)zdump.c 8.6"; +** 2009-05-17 by Arthur David Olson. +*/ /* ** This code has been made independent of the rest of the time @@ -235,6 +235,16 @@ const char * const zone; warned = TRUE; } +static void +usage(stream, status) +FILE * const stream; +const int status; +{ + (void) fprintf(stream, +_("usage: %s [-v] [-c [loyear,]hiyear] zonename ...\n"), progname); + exit(status); +} + int main(argc, argv) int argc; @@ -275,10 +285,7 @@ char * argv[]; else cutarg = optarg; if ((c != EOF && c != -1) || (optind == argc - 1 && strcmp(argv[optind], "=") == 0)) { - (void) fprintf(stderr, -_("usage: %s [-v] [-c [loyear,]hiyear] zonename ...\n"), - progname); - exit(EXIT_FAILURE); + usage(stderr, EXIT_FAILURE); } if (vflag) { if (cutarg != NULL) { @@ -349,13 +356,9 @@ _("usage: %s [-v] [-c [loyear,]hiyear] zonename ...\n"), strlcpy(buf, abbr(&tm), sizeof buf); } for ( ; ; ) { - if (t >= cuthitime) + if (t >= cuthitime || t >= cuthitime - SECSPERHOUR * 12) break; newt = t + SECSPERHOUR * 12; - if (newt >= cuthitime) - break; - if (newt <= t) - break; newtmp = localtime(&newt); if (newtmp != NULL) newtm = *newtmp; diff --git a/lib/libc/time/zic.8 b/lib/libc/time/zic.8 index c5982f09b13..3533fd6fa8b 100644 --- a/lib/libc/time/zic.8 +++ b/lib/libc/time/zic.8 @@ -1,5 +1,5 @@ -.\" $OpenBSD: zic.8,v 1.26 2007/06/30 13:20:42 millert Exp $ -.Dd $Mdocdate: June 30 2007 $ +.\" $OpenBSD: zic.8,v 1.27 2010/08/23 22:35:34 millert Exp $ +.Dd $Mdocdate: August 23 2010 $ .Dt ZIC 8 .Os .Sh NAME @@ -76,6 +76,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: .Bd -literal -offset indent Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -443,6 +446,6 @@ produces a single transition to daylight saving at the new UTC offset To get separate transitions use multiple zone continuation lines specifying transition instants using universal time. -.\" @(#)zic.8 8.4 +.\" @(#)zic.8 8.6 .\" This file is in the public domain, so clarified as of -.\" 2003-02-14 by Arthur David Olson. +.\" 2009-05-17 by Arthur David Olson. diff --git a/lib/libc/time/zic.c b/lib/libc/time/zic.c index 2d6facacbf1..a9915c40034 100644 --- a/lib/libc/time/zic.c +++ b/lib/libc/time/zic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zic.c,v 1.31 2008/01/07 01:09:37 millert Exp $ */ +/* $OpenBSD: zic.c,v 1.32 2010/08/23 22:35:34 millert Exp $ */ /* ** This file is in the public domain, so clarified as of ** 2006-07-17 by Arthur David Olson. @@ -8,11 +8,7 @@ #include "locale.h" #include "tzfile.h" -#ifdef notyet #define ZIC_VERSION '2' -#else -#define ZIC_VERSION '\0' -#endif typedef int_fast64_t zic_t; @@ -159,7 +155,7 @@ static void stringzone(char * result, size_t size, const struct zone * zp, int ntzones); static void setboundaries(void); static zic_t tadd(zic_t t1, long t2); -static void usage(void); +static void usage(FILE *stream, int status); static void writezone(const char * name, const char * string); static int yearistype(int year, const char * type); @@ -457,11 +453,11 @@ const char * const string; } static void -usage(void) +usage(FILE *stream, int status) { - (void) fprintf(stderr, _("usage: %s [-v] [-d directory] [-L leapsecondfilename] [-l timezone]\n\t[-p timezone] [-y command] [filename ...]\n"), + (void) fprintf(stream, _("usage: %s [-v] [-d directory] [-L leapsecondfilename] [-l timezone]\n\t[-p timezone] [-y command] [filename ...]\n"), progname); - exit(EXIT_FAILURE); + exit(status); } static const char * psxrules; @@ -498,7 +494,7 @@ char * argv[]; while ((c = getopt(argc, argv, "d:l:p:L:vy:")) != -1) switch (c) { default: - usage(); + usage(stderr, EXIT_FAILURE); case 'd': if (directory == NULL) directory = optarg; @@ -554,7 +550,7 @@ _("%s: More than one -L option specified\n"), break; } if (optind == argc - 1 && strcmp(argv[optind], "=") == 0) - usage(); /* usage message by request */ + usage(stderr, EXIT_FAILURE); /* usage message by request */ if (directory == NULL) directory = TZDIR; if (yitcommand == NULL) @@ -1554,11 +1550,7 @@ const char * const string; exit(EXIT_FAILURE); } } -#ifdef notyet for (pass = 1; pass <= 2; ++pass) { -#else - pass = 1; { -#endif register int thistimei, thistimecnt; register int thisleapi, thisleapcnt; register int thistimelim, thisleaplim; @@ -1701,9 +1693,7 @@ const char * const string; if (writetype[i]) (void) putc(ttisgmts[i], fp); } -#ifdef notyet (void) fprintf(fp, "\n%s\n", string); -#endif if (ferror(fp) || fclose(fp)) { (void) fprintf(stderr, _("%s: Error writing %s\n"), progname, fullname); @@ -1916,7 +1906,7 @@ const int zonecount; if (stdrp != NULL && stdrp->r_hiyear == 2037) return; } - if (stdrp == NULL && zp->z_nrules != 0) + if (stdrp == NULL && (zp->z_nrules != 0 || zp->z_stdoff != 0)) return; abbrvar = (stdrp == NULL) ? "" : stdrp->r_abbrvar; doabbr(result, size, zp->z_format, abbrvar, FALSE, TRUE); @@ -1994,7 +1984,7 @@ const int zonecount; min_year = max_year = EPOCH_YEAR; if (leapseen) { updateminmax(leapminyear); - updateminmax(leapmaxyear); + updateminmax(leapmaxyear + (leapmaxyear < INT_MAX)); } for (i = 0; i < zonecount; ++i) { zp = &zpfirst[i]; |