Second part of the timezone code import for version 96h. This includes

a number of bug fixes to the compiler (which bugs would previously
have caused undesirable behavior during transition times).
This commit is contained in:
Garrett Wollman 1996-07-18 19:40:52 +00:00
parent 979a211643
commit 22c654616a
10 changed files with 792 additions and 397 deletions

81
usr.sbin/zic/Music Normal file
View File

@ -0,0 +1,81 @@
@(#)Music 7.4
Data on recordings of "Save That Time," Russ Long, Serrob Publishing, BMI:
--------------------------------------------------------------------------
Artist: Karrin Allyson
CD: I Didn't Know About You
Copyright Date: 1993
Label: Concord Jazz, Inc.
ID: CCD-4543
Track Time: 3:44
Personnel: Karrin Allyson, vocal
Russ Long, piano
Gerald Spaits, bass
Todd Strait, drums
Notes: CD notes "additional lyric by Karrin Allyson;
arranged by Russ Long and Karrin Allyson"
Rating: 1 star
--------------------------------------------------------------------------
Artist: Kevin Mahogany
CD: Double Rainbow
Copyright Date: 1993
Label: Enja Records
ID: ENJ-7097 2
Track Time: 6:27
Personnel: Kevin Mahogany, vocal
Kenny Barron, piano
Ray Drummond, bss
Ralph Moore, tenor saxophone
Lewis Nash, drums
Rating: 1.5 stars
--------------------------------------------------------------------------
Artist: Joe Williams
CD: Here's to Life
Copyright Date: 1994
Label: Telarc International Corporation
ID: CD-83357
Track Time: 3:58
Personnel: Joe Williams, vocal
The Robert Farnon [39 piece] Orchestra
Rating: black dot
--------------------------------------------------------------------------
Artist: Charles Fambrough
CD: Keeper of the Spirit
Copyright Date: 1995
Label: AudioQuest Music
ID: AQ-CD1033
Track Time: 7:07
Personnel: Charles Fambrough, bass
Joel Levine, tenor recorder
Edward Simon, piano
Lenny White, drums
Marion Simon, percussion
Rating: 2 stars
==========================================================================
Also of note:
Artist: Milt Hinton
CD: Old Man Time
Date: 1993
Label: Chiaroscuro
ID: CR(D) 310
Total Time: 149:38 (two CDs)
Personnel: Milt Hinton, bass
Doc Cheatham, Dizzy Gillespie, Clark Terry, trumpet
Al Grey, trombone
Eddier Barefield, Joe Camel (Flip Phillips), Buddy Tate,
clarinet and saxophone
John Bunch, Red Richards, Norman Simmons, Derek Smith,
Ralph Sutton, piano
Danny Barker, Al Casey, guitar
Gus Johnson, Gerryck King, Bob Rosengarden, Jackie Williams,
drums
Lionel Hampton, vibraphone
Cab Calloway, Joe Williams, vocal
Buck Clayton, arrangements
Notes: tunes include Old Man Time, Time After Time,
Sometimes I'm Happy,
A Hot Time in the Old Town Tonight,
Four or Five Times, Now's the Time,
Time on My Hands, This Time It's Us,
and Good Time Charlie
Rating: 3 stars

View File

@ -1,4 +1,4 @@
@(#)README 7.5
@(#)README 7.8
"What time is it?" -- Richard Deacon as The King
"Any time you want it to be." -- Frank Baxter as The Scientist
@ -22,13 +22,6 @@ and as "part of the application" in others, there's no good way to name
functions, such as timegm, that are not part of the proposed ANSI C standard;
such functions have kept their old, underscore-free names in this update.)
Support for the tz_abbr variable has been eliminated from this version
(to forestall "kitchen sink" complaints from certain quarters :-).
Support for Turbo C compilation has also been eliminated; it was present to
allow checking in an ANSI-style environment, and such checking is now done with
gcc.
And the "dysize" function has disappeared; it was present to allow compilation
of the "date" command on old BSD systems, and a version of "date" is now
provided in the package. The "date" command is not created when you "make all"
@ -64,9 +57,10 @@ Thanks to these Timezone Caballeros who've made major contributions to the
time conversion package: Keith Bostic; Bob Devine; Paul Eggert; Robert Elz;
Guy Harris; Mark Horton; John Mackin; and Bradley White. Thanks also to
Michael Bloom, Art Neilson, Stephen Prince, John Sovereign, and Frank Wales
for testing work. None of them are responsible for remaining errors.
for testing work, and to Gwillim Law for checking local mean time data.
None of them are responsible for remaining errors.
Look in the ~ftp/pub directory of elsie.nci.nih.gov (128.231.16.1)
Look in the ~ftp/pub directory of elsie.nci.nih.gov
for updated versions of these files.
Please send comments or information to ado@elsie.nci.nih.gov.
Please send comments or information to tz@elsie.nci.nih.gov.

View File

@ -1,4 +1,4 @@
@(#)Theory 7.2
@(#)Theory 7.4
These time and date functions are much like the System V Release 2.0 (SVR2)
time and date functions; there are a few additions and changes to extend
@ -47,7 +47,7 @@ These are the changes that have been made to the SVR2 functions:
abbreviations are used.
It was recognized that allowing the "TZ" environment variable to
take on values such as "US/Eastern" might cause "old" programs
take on values such as "America/New_York" might cause "old" programs
(that expect "TZ" to have a certain form) to operate incorrectly;
consideration was given to using some other environment variable
(for example, "TIMEZONE") to hold the string used to generate the
@ -79,8 +79,8 @@ These are the changes that have been made to the SVR2 functions:
best approximation to local wall clock time to be delivered by
subsequent calls to "localtime." Source code for portable
applications that "must" run on local wall clock time should call
"tzsetwall();" if such code is moved to "old" systems that don't provide
tzsetwall, you won't be able to generate an executable program.
"tzsetwall();" if such code is moved to "old" systems that don't
provide tzsetwall, you won't be able to generate an executable program.
(These time zone functions also arrange for local wall clock time to be
used if tzset is called--directly or indirectly--and there's no "TZ"
environment variable; portable applications should not, however, rely
@ -94,8 +94,8 @@ Points of interest to folks with Version 7 or BSD systems:
time zone abbreviation, and we refuse to guess.
Programs that in the past used the timezone function may now examine
tzname[localtime(&clock)->tm_isdst] to learn the correct time
zone abbreviation to use. Alternatively, use localtime(&clock)->tm_zone
if this has been enabled.
zone abbreviation to use. Alternatively, use
localtime(&clock)->tm_zone if this has been enabled.
* The BSD gettimeofday function is not used in this package;
this lets users control the time zone used in doing time conversions.
@ -104,10 +104,10 @@ Points of interest to folks with Version 7 or BSD systems:
file "/etc/zoneinfo/localtime"; see the time zone compiler writeup for
information on how to initialize this file.
The functions that are conditionally compiled if STD_INSPIRED is defined should,
at this point, be looked on primarily as food for thought. They are not in
any sense "standard compatible"--some are not, in fact, specified in *any*
standard. They do, however, represent responses of various authors to
The functions that are conditionally compiled if STD_INSPIRED is defined
should, at this point, be looked on primarily as food for thought. They are
not in any sense "standard compatible"--some are not, in fact, specified in
*any* standard. They do, however, represent responses of various authors to
standardization proposals.
Other time conversion proposals, in particular the one developed by folks at

71
usr.sbin/zic/WWW Normal file
View File

@ -0,0 +1,71 @@
# '@(#)WWW 7.3'
# From Paul Eggert <eggert@twinsun.com> (1995-11-03)
#
# The Web has several other sources for time zone and daylight savings data.
# Here are some recent links that may be of interest.
#
# Date and Time Gateway
# http://www.bsdi.com/date
# A text-based source for tables of current time throughout the world.
# Its point-and-click interface accesses a recent version of the tz data.
#
# Local Times Around the World
# http://www.hilink.com.au/times/
# This text-based system contains links to local time servers
# throughout the world, and though the coverage is limited,
# the live data provide a nice way to check one's tables.
#
# World Time Zones
# http://tycho.usno.navy.mil/tzones.html
# US Naval Observatory data, used as the source for `usno1995'.
#
# Standard Time Zones of the World
# http://www.odci.gov/cia/publications/95fact/802389.gif [54 kB]
# http://www.odci.gov/cia/publications/95fact/802389h.gif [1317 kB]
# A static time zone map, available in both low-resolution and
# high-resolution versions. The quality is good, but the map does not
# indicate summer time, and parts of the data are a few years out of date.
#
# VIBE's World Map
# http://pathfinder.com/vibe/vibeworld
# An active time zone map. You can point to the map and find out what
# time it is at that location. The map and data are not as good as
# other sources.
###############################################################################
# From Manavendra Thakur <Manavendra_Thakur@NeXT.COM> (1995-11-06)
#
# To Paul's list of time zone information on the web, I would add the
# following URL:
# http://www.dhl.com/dhl/dhlinfo/1bb.html
# or more simply:
# http://www.dhl.com/
#
# This is run by DHL (the courier company), and it presents a list of the
# countries served by that company. If you then click on a particular
# country, here's an example of what you'll see (graphics stripped out):
#
# United Kingdom
#
# HOLIDAYS: Jan 1, 2, Apr 14, 17, May 1, 29, Aug 28, Dec 25, 26
#
# INTERNATIONAL DIALING CODE: +44
#
# CURRENT LOCAL TIME: 09:41 Monday 6 November 1995
#
# I find this rather handy, and given that DHL covers 217 countries and
# territories, it's pretty comprehensive coverage.
#
# (I have no idea what system DHL is using to calculate the local time, but
# it's been accurate so far.)
###############################################################################
# From Arthur David Olson <arthur_david_olson@nih.gov> (1996-01-04)
#
# A good source of information about ISO 8601 seems to be
# http://www.ft.uni-erlangen.de/~mskuhn/iso-time.html
# maintained by Markus Kuhn.

View File

@ -1,6 +1,6 @@
#ifndef lint
#ifndef NOID
static char elsieid[] = "@(#)ialloc.c 8.21";
static char elsieid[] = "@(#)ialloc.c 8.28";
#endif /* !defined NOID */
#endif /* !defined lint */
@ -8,35 +8,20 @@ static char elsieid[] = "@(#)ialloc.c 8.21";
#include "private.h"
#ifdef MAL
#define NULLMAL(x) ((x) == NULL || (x) == MAL)
#endif /* defined MAL */
#ifndef MAL
#define NULLMAL(x) ((x) == NULL)
#endif /* !defined MAL */
#define nonzero(n) (((n) == 0) ? 1 : (n))
char * icalloc P((int nelem, int elsize));
char * icatalloc P((char * old, const char * new));
char * icpyalloc P((const char * string));
char * imalloc P((int n));
char * irealloc P((char * pointer, int size));
void * irealloc P((void * pointer, int size));
void ifree P((char * pointer));
char *
imalloc(n)
const int n;
{
#ifdef MAL
register char * result;
result = malloc((alloc_size_t) nonzero(n));
return NULLMAL(result) ? NULL : result;
#endif /* defined MAL */
#ifndef MAL
return malloc((alloc_size_t) nonzero(n));
#endif /* !defined MAL */
return malloc((size_t) nonzero(n));
}
char *
@ -46,17 +31,17 @@ int elsize;
{
if (nelem == 0 || elsize == 0)
nelem = elsize = 1;
return calloc((alloc_size_t) nelem, (alloc_size_t) elsize);
return calloc((size_t) nelem, (size_t) elsize);
}
char *
void *
irealloc(pointer, size)
char * const pointer;
void * const pointer;
const int size;
{
if (NULLMAL(pointer))
if (pointer == NULL)
return imalloc(size);
return realloc((genericptr_t) pointer, (alloc_size_t) nonzero(size));
return realloc((void *) pointer, (size_t) nonzero(size));
}
char *
@ -67,14 +52,14 @@ const char * const new;
register char * result;
register int oldsize, newsize;
newsize = NULLMAL(new) ? 0 : strlen(new);
if (NULLMAL(old))
newsize = (new == NULL) ? 0 : strlen(new);
if (old == NULL)
oldsize = 0;
else if (newsize == 0)
return old;
else oldsize = strlen(old);
if ((result = irealloc(old, oldsize + newsize + 1)) != NULL)
if (!NULLMAL(new))
if (new != NULL)
(void) strcpy(result + oldsize, new);
return result;
}
@ -90,7 +75,7 @@ void
ifree(p)
char * const p;
{
if (!NULLMAL(p))
if (p != NULL)
(void) free(p);
}
@ -98,6 +83,6 @@ void
icfree(p)
char * const p;
{
if (!NULLMAL(p))
if (p != NULL)
(void) free(p);
}

View File

@ -1,6 +1,6 @@
#ifndef lint
#ifndef NOID
static char elsieid[] = "@(#)scheck.c 8.11";
static char elsieid[] = "@(#)scheck.c 8.13";
#endif /* !defined lint */
#endif /* !defined NOID */
@ -14,7 +14,7 @@ extern void ifree P((char * p));
char *
scheck(string, format)
const char * const string;
const char * const format;
char * const format;
{
register char * fbuf;
register const char * fp;
@ -22,12 +22,12 @@ const char * const format;
register int c;
register char * result;
char dummy;
static char nada[1];
static char nada;
result = nada;
result = &nada;
if (string == NULL || format == NULL)
return result;
fbuf = imalloc(2 * strlen(format) + 4);
fbuf = imalloc((int) (2 * strlen(format) + 4));
if (fbuf == NULL)
return result;
fp = format;
@ -42,7 +42,7 @@ const char * const format;
*tp++ = '*';
if (*fp == '*')
++fp;
while (isascii(*fp) && isdigit(*fp))
while (is_digit(*fp))
*tp++ = *fp++;
if (*fp == 'l' || *fp == 'h')
*tp++ = *fp++;

View File

@ -20,8 +20,7 @@ These options are available:
For each
.I zonename
on the command line,
print the current time,
the time at the lowest possible time value,
print the time at the lowest possible time value,
the time one day after the lowest possible time value,
the times both one second before and exactly at
each detected time discontinuity,
@ -37,4 +36,4 @@ otherwise.
Cut off the verbose output near the start of the given year.
.SH "SEE ALSO"
newctime(3), tzfile(5), zic(8)
.\" @(#)zdump.8 7.2
.\" @(#)zdump.8 7.3

View File

@ -1,6 +1,6 @@
#ifndef lint
#ifndef NOID
static char elsieid[] = "@(#)zdump.c 7.10";
static char elsieid[] = "@(#)zdump.c 7.24";
#endif /* !defined NOID */
#endif /* !defined lint */
@ -10,10 +10,11 @@ static char elsieid[] = "@(#)zdump.c 7.10";
** You can use this code to help in verifying other implementations.
*/
#include "stdio.h" /* for stdout, stderr */
#include "stdio.h" /* for stdout, stderr, perror */
#include "string.h" /* for strcpy */
#include "sys/types.h" /* for time_t */
#include "time.h" /* for struct tm */
#include "stdlib.h" /* for exit, malloc, atoi */
#ifndef MAX_STRING_LENGTH
#define MAX_STRING_LENGTH 1024
@ -67,18 +68,55 @@ static char elsieid[] = "@(#)zdump.c 7.10";
#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
#endif /* !defined isleap */
#if HAVE_GETTEXT - 0
#include "locale.h" /* for setlocale */
#include "libintl.h"
#endif /* HAVE_GETTEXT - 0 */
#ifndef GNUC_or_lint
#ifdef lint
#define GNUC_or_lint
#endif /* defined lint */
#ifndef lint
#ifdef __GNUC__
#define GNUC_or_lint
#endif /* defined __GNUC__ */
#endif /* !defined lint */
#endif /* !defined GNUC_or_lint */
#ifndef INITIALIZE
#ifdef GNUC_or_lint
#define INITIALIZE(x) ((x) = 0)
#endif /* defined GNUC_or_lint */
#ifndef GNUC_or_lint
#define INITIALIZE(x)
#endif /* !defined GNUC_or_lint */
#endif /* !defined INITIALIZE */
/*
** For the benefit of GNU folk...
** `_(MSGID)' uses the current locale's message library string for MSGID.
** The default is to use gettext if available, and use MSGID otherwise.
*/
#ifndef _
#if HAVE_GETTEXT - 0
#define _(msgid) gettext(msgid)
#else /* !(HAVE_GETTEXT - 0) */
#define _(msgid) msgid
#endif /* !(HAVE_GETTEXT - 0) */
#endif /* !defined _ */
#ifndef TZ_DOMAIN
#define TZ_DOMAIN "tz"
#endif /* !defined TZ_DOMAIN */
extern char ** environ;
extern int getopt();
extern char * optarg;
extern int optind;
extern time_t time();
extern char * tzname[2];
extern void tzset();
#ifdef USG
extern void exit();
extern void perror();
#endif /* defined USG */
static char * abbr();
static long delta();
@ -92,16 +130,28 @@ main(argc, argv)
int argc;
char * argv[];
{
register int i, c;
register int vflag;
register char * cutoff;
register int cutyear;
register long cuttime;
time_t now;
time_t t, newt;
time_t hibit;
struct tm tm, newtm;
register int i;
register int c;
register int vflag;
register char * cutoff;
register int cutyear;
register long cuttime;
char ** fakeenv;
time_t now;
time_t t;
time_t newt;
time_t hibit;
struct tm tm;
struct tm newtm;
INITIALIZE(cuttime);
#if HAVE_GETTEXT - 0
(void) setlocale(LC_MESSAGES, "");
#ifdef TZ_DOMAINDIR
(void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR);
#endif /* defined(TEXTDOMAINDIR) */
(void) textdomain(TZ_DOMAIN);
#endif /* HAVE_GETTEXT - 0 */
progname = argv[0];
vflag = 0;
cutoff = NULL;
@ -112,7 +162,7 @@ char * argv[];
if (c != EOF ||
(optind == argc - 1 && strcmp(argv[optind], "=") == 0)) {
(void) fprintf(stderr,
"%s: usage is %s [ -v ] [ -c cutoff ] zonename ...\n",
_("%s: usage is %s [ -v ] [ -c cutoff ] zonename ...\n"),
argv[0], argv[0]);
(void) exit(EXIT_FAILURE);
}
@ -132,28 +182,36 @@ char * argv[];
longest = strlen(argv[i]);
for (hibit = 1; (hibit << 1) != 0; hibit <<= 1)
continue;
for (i = optind; i < argc; ++i) {
register char ** saveenv;
static char buf[MAX_STRING_LENGTH];
char * fakeenv[2];
{
register int from;
register int to;
if (strlen(argv[i]) + 4 > sizeof buf) {
(void) fflush(stdout);
(void) fprintf(stderr, "%s: argument too long -- %s\n",
progname, argv[i]);
(void) exit(EXIT_FAILURE);
}
(void) strcpy(buf, "TZ=");
(void) strcat(buf, argv[i]);
fakeenv[0] = buf;
fakeenv[1] = NULL;
saveenv = environ;
environ = fakeenv;
(void) tzset();
environ = saveenv;
show(argv[i], now, FALSE);
if (!vflag)
for (i = 0; environ[i] != NULL; ++i)
continue;
fakeenv = (char **) malloc((size_t) ((i + 2) *
sizeof *fakeenv));
if (fakeenv == NULL ||
(fakeenv[0] = (char *) malloc((size_t) (longest +
4))) == NULL) {
(void) perror(progname);
(void) exit(EXIT_FAILURE);
}
to = 0;
(void) strcpy(fakeenv[to++], "TZ=");
for (from = 0; environ[from] != NULL; ++from)
if (strncmp(environ[from], "TZ=", 3) != 0)
fakeenv[to++] = environ[from];
fakeenv[to] = NULL;
environ = fakeenv;
}
for (i = optind; i < argc; ++i) {
static char buf[MAX_STRING_LENGTH];
(void) strcpy(&fakeenv[0][3], argv[i]);
if (!vflag) {
show(argv[i], now, FALSE);
continue;
}
/*
** Get lowest value of t.
*/
@ -197,9 +255,9 @@ char * argv[];
show(argv[i], t, TRUE);
}
if (fflush(stdout) || ferror(stdout)) {
(void) fprintf(stderr, "%s: Error writing standard output ",
(void) fprintf(stderr, _("%s: Error writing standard output "),
argv[0]);
(void) perror("standard output");
(void) perror(_("standard output"));
(void) exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
@ -268,14 +326,15 @@ struct tm * oldp;
return result;
}
extern struct tm * localtime();
static void
show(zone, t, v)
char * zone;
time_t t;
int v;
{
struct tm * tmp;
extern struct tm * localtime();
struct tm * tmp;
(void) printf("%-*s ", longest, zone);
if (v)
@ -298,10 +357,10 @@ abbr(tmp)
struct tm * tmp;
{
register char * result;
static char nada[1];
static char nada;
if (tmp->tm_isdst != 0 && tmp->tm_isdst != 1)
return nada;
return &nada;
result = tzname[tmp->tm_isdst];
return (result == NULL) ? nada : result;
return (result == NULL) ? &nada : result;
}

View File

@ -154,17 +154,7 @@ then the rule applies in all years between
.B FROM
and
.B TO
inclusive;
if
.B TYPE
is
.BR uspres ,
the rule applies in U.S. Presidential election years;
if
.B TYPE
is
.BR nonpres ,
the rule applies in years other than U.S. Presidential election years.
inclusive.
If
.B TYPE
is something else, then
@ -219,14 +209,18 @@ Any of these forms may be followed by the letter
.B w
if the given time is local
.q "wall clock"
time or
time,
.B s
if the given time is local
.q standard
time; in the absence of
.B w
time, or
.B u
(or
.B g
or
.BR s ,
.BR z )
if the given time is universal time;
in the absence of an indicator,
wall clock time is assumed.
.TP
.B SAVE
@ -300,6 +294,9 @@ The pair of characters
is used to show where the
.q "variable part"
of the time zone abbreviation goes.
Alternately,
a slash (/)
separates standard and daylight abbreviations.
.TP
.B UNTIL
The time at which the GMT offset or the rule(s) change for a location.
@ -326,14 +323,13 @@ A link line has the form
.sp
.nf
.ti +.5i
.if t .ta \w'Link\0\0'u +\w'LINK-FROM\0\0'u
.if n .ta \w'Link\0\0'u +\w'US/Eastern\0\0'u
.ta \w'Link\0\0'u +\w'Europe/Istanbul\0\0'u
Link LINK-FROM LINK-TO
.sp
For example:
.sp
.ti +.5i
Link US/Eastern EST5EDT
Link Europe/Istanbul Asia/Istanbul
.sp
.fi
The
@ -409,4 +405,4 @@ the earliest transition time recorded in the compiled file is correct.
/usr/local/etc/zoneinfo standard directory used for created files
.SH "SEE ALSO"
newctime(3), tzfile(5), zdump(8)
.\" @(#)zic.8 7.7
.\" @(#)zic.8 7.12

File diff suppressed because it is too large Load Diff