The European Commission went out and invented a new sort of summer-time

changeover, so we have to extend the format of timezone files (in a backward-
compatible way, of course).  This probably means that libc needs a minor
version number bump before 2.2 is released (or maybe not).
This commit is contained in:
Garrett Wollman 1995-08-05 20:28:08 +00:00
parent 21271a8c7a
commit 35482326b2
3 changed files with 322 additions and 225 deletions

View File

@ -1,6 +1,6 @@
#ifndef lint
#ifndef NOID
static char elsieid[] = "@(#)localtime.c 7.19";
static char elsieid[] = "@(#)localtime.c 7.44";
#endif /* !defined NOID */
#endif /* !defined lint */
@ -16,7 +16,9 @@ static char elsieid[] = "@(#)localtime.c 7.19";
#include "tzfile.h"
#include "fcntl.h"
#define ACCESS_MODE O_RDONLY
/*
** SunOS 4.1.1 headers lack O_BINARY.
*/
#ifdef O_BINARY
#define OPEN_MODE (O_RDONLY | O_BINARY)
@ -29,9 +31,9 @@ static char elsieid[] = "@(#)localtime.c 7.19";
/*
** Someone might make incorrect use of a time zone abbreviation:
** 1. They might reference tzname[0] before calling tzset (explicitly
** or implicitly).
** or implicitly).
** 2. They might reference tzname[1] before calling tzset (explicitly
** or implicitly).
** or implicitly).
** 3. They might reference tzname[1] after setting to a time zone
** in which Daylight Saving Time is never observed.
** 4. They might reference tzname[0] after setting to a time zone
@ -48,13 +50,16 @@ static char elsieid[] = "@(#)localtime.c 7.19";
#define WILDABBR " "
#endif /* !defined WILDABBR */
static const char GMT[] = "GMT";
static char wildabbr[] = "WILDABBR";
static const char gmt[] = "GMT";
struct ttinfo { /* time type information */
long tt_gmtoff; /* GMT offset in seconds */
int tt_isdst; /* used to set tm_isdst */
int tt_abbrind; /* abbreviation list index */
int tt_ttisstd; /* TRUE if transition is std time */
int tt_ttisgmt; /* TRUE if transition is GMT */
};
struct lsinfo { /* leap second information */
@ -79,7 +84,7 @@ struct state {
time_t ats[TZ_MAX_TIMES];
unsigned char types[TZ_MAX_TIMES];
struct ttinfo ttis[TZ_MAX_TYPES];
char chars[BIGGEST(BIGGEST(TZ_MAX_CHARS + 1, sizeof GMT),
char chars[BIGGEST(BIGGEST(TZ_MAX_CHARS + 1, sizeof gmt),
(2 * (MY_TZNAME_MAX + 1)))];
struct lsinfo lsis[TZ_MAX_LEAPS];
};
@ -116,9 +121,13 @@ static int increment_overflow P((int * number, int delta));
static int normalize_overflow P((int * tensptr, int * unitsptr,
int base));
static void settzname P((void));
static time_t time1 P((struct tm * tmp, void (* funcp)(),
static time_t time1 P((struct tm * tmp,
void(*funcp) P((const time_t *,
long, struct tm *)),
long offset));
static time_t time2 P((struct tm *tmp, void (* funcp)(),
static time_t time2 P((struct tm *tmp,
void(*funcp) P((const time_t *,
long, struct tm*)),
long offset, int * okayp));
static void timesub P((const time_t * timep, long offset,
const struct state * sp, struct tm * tmp));
@ -142,14 +151,29 @@ static struct state gmtmem;
#define gmtptr (&gmtmem)
#endif /* State Farm */
#ifndef TZ_STRLEN_MAX
#define TZ_STRLEN_MAX 255
#endif /* !defined TZ_STRLEN_MAX */
static char lcl_TZname[TZ_STRLEN_MAX + 1];
static int lcl_is_set;
static int gmt_is_set;
char * tzname[2] = {
WILDABBR,
WILDABBR
wildabbr,
wildabbr
};
/*
** Section 4.12.3 of X3.159-1989 requires that
** Except for the strftime function, these functions [asctime,
** ctime, gmtime, localtime] return values in one of two static
** objects: a broken-down time structure and an array of char.
** Thanks to Paul Eggert (eggert@twinsun.com) for noting this.
*/
static struct tm tm;
#ifdef USG_COMPAT
time_t timezone = 0;
int daylight = 0;
@ -166,20 +190,20 @@ const char * const codep;
register long result;
register int i;
result = 0;
result = (codep[0] & 0x80) ? ~0L : 0L;
for (i = 0; i < 4; ++i)
result = (result << 8) | (codep[i] & 0xff);
return result;
}
static void
settzname()
settzname P((void))
{
register const struct state * const sp = lclptr;
register struct state * const sp = lclptr;
register int i;
tzname[0] = WILDABBR;
tzname[1] = WILDABBR;
tzname[0] = wildabbr;
tzname[1] = wildabbr;
#ifdef USG_COMPAT
daylight = 0;
timezone = 0;
@ -189,7 +213,7 @@ settzname()
#endif /* defined ALTZONE */
#ifdef ALL_STATE
if (sp == NULL) {
tzname[0] = tzname[1] = GMT;
tzname[0] = tzname[1] = gmt;
return;
}
#endif /* defined ALL_STATE */
@ -197,7 +221,7 @@ settzname()
register const struct ttinfo * const ttisp = &sp->ttis[i];
tzname[ttisp->tt_isdst] =
(char *) &sp->chars[ttisp->tt_abbrind];
&sp->chars[ttisp->tt_abbrind];
#ifdef USG_COMPAT
if (ttisp->tt_isdst)
daylight = 1;
@ -218,7 +242,7 @@ settzname()
sp->types[i]];
tzname[ttisp->tt_isdst] =
(char *) &sp->chars[ttisp->tt_abbrind];
&sp->chars[ttisp->tt_abbrind];
}
}
@ -234,7 +258,14 @@ register struct state * const sp;
if (name == NULL && (name = TZDEFAULT) == NULL)
return -1;
{
register int doaccess;
register int doaccess;
/*
** Section 4.9.1 of the C standard says that
** "FILENAME_MAX expands to an integral constant expression
** that is the sie needed for an array of char large enough
** to hold the longest file name string that the implementation
** guarantees can be opened."
*/
char fullname[FILENAME_MAX + 1];
if (name[0] == ':')
@ -255,39 +286,49 @@ register struct state * const sp;
doaccess = TRUE;
name = fullname;
}
if (doaccess && access(name, ACCESS_MODE) != 0)
if (doaccess && access(name, R_OK) != 0)
return -1;
if ((fid = open(name, OPEN_MODE)) == -1)
return -1;
}
{
register const struct tzhead * tzhp;
char buf[sizeof *sp + sizeof *tzhp];
int ttisstdcnt;
struct tzhead * tzhp;
char buf[sizeof *sp + sizeof *tzhp];
int ttisstdcnt;
int ttisgmtcnt;
i = read(fid, buf, sizeof buf);
if (close(fid) != 0 || i < sizeof *tzhp)
if (close(fid) != 0)
return -1;
tzhp = (struct tzhead *) buf;
ttisstdcnt = (int) detzcode(tzhp->tzh_ttisstdcnt);
sp->leapcnt = (int) detzcode(tzhp->tzh_leapcnt);
sp->timecnt = (int) detzcode(tzhp->tzh_timecnt);
sp->typecnt = (int) detzcode(tzhp->tzh_typecnt);
sp->charcnt = (int) detzcode(tzhp->tzh_charcnt);
p = buf;
p += sizeof tzhp->tzh_reserved;
ttisstdcnt = (int) detzcode(p);
p += 4;
ttisgmtcnt = (int) detzcode(p);
p += 4;
sp->leapcnt = (int) detzcode(p);
p += 4;
sp->timecnt = (int) detzcode(p);
p += 4;
sp->typecnt = (int) detzcode(p);
p += 4;
sp->charcnt = (int) detzcode(p);
p += 4;
if (sp->leapcnt < 0 || sp->leapcnt > TZ_MAX_LEAPS ||
sp->typecnt <= 0 || sp->typecnt > TZ_MAX_TYPES ||
sp->timecnt < 0 || sp->timecnt > TZ_MAX_TIMES ||
sp->charcnt < 0 || sp->charcnt > TZ_MAX_CHARS ||
(ttisstdcnt != sp->typecnt && ttisstdcnt != 0))
(ttisstdcnt != sp->typecnt && ttisstdcnt != 0) ||
(ttisgmtcnt != sp->typecnt && ttisgmtcnt != 0))
return -1;
if (i < sizeof *tzhp +
sp->timecnt * (4 + sizeof (char)) +
sp->typecnt * (4 + 2 * sizeof (char)) +
sp->charcnt * sizeof (char) +
sp->leapcnt * 2 * 4 +
ttisstdcnt * sizeof (char))
if (i - (p - buf) < sp->timecnt * 4 + /* ats */
sp->timecnt + /* types */
sp->typecnt * (4 + 2) + /* ttinfos */
sp->charcnt + /* chars */
sp->leapcnt * (4 + 4) + /* lsinfos */
ttisstdcnt + /* ttisstds */
ttisgmtcnt) /* ttisgmts */
return -1;
p = buf + sizeof *tzhp;
for (i = 0; i < sp->timecnt; ++i) {
sp->ats[i] = detzcode(p);
p += 4;
@ -336,6 +377,19 @@ register struct state * const sp;
return -1;
}
}
for (i = 0; i < sp->typecnt; ++i) {
register struct ttinfo * ttisp;
ttisp = &sp->ttis[i];
if (ttisgmtcnt == 0)
ttisp->tt_ttisgmt = FALSE;
else {
ttisp->tt_ttisgmt = *p++;
if (ttisp->tt_ttisgmt != TRUE &&
ttisp->tt_ttisgmt != FALSE)
return -1;
}
}
}
return 0;
}
@ -414,10 +468,16 @@ long * const secsp;
{
int num;
strp = getnum(strp, &num, 0, HOURSPERDAY);
/*
** `HOURSPERDAY * DAYSPERWEEK - 1' allows quasi-Posix rules like
** "M10.4.6/26", which does not conform to Posix,
** but which specifies the equivalent of
** ``02:00 on the first Sunday on or after 23 Oct''.
*/
strp = getnum(strp, &num, 0, HOURSPERDAY * DAYSPERWEEK - 1);
if (strp == NULL)
return NULL;
*secsp = num * SECSPERHOUR;
*secsp = num * (long) SECSPERHOUR;
if (*strp == ':') {
++strp;
strp = getnum(strp, &num, 0, MINSPERHOUR - 1);
@ -426,7 +486,8 @@ long * const secsp;
*secsp += num * SECSPERMIN;
if (*strp == ':') {
++strp;
strp = getnum(strp, &num, 0, SECSPERMIN - 1);
/* `SECSPERMIN' allows for leap seconds. */
strp = getnum(strp, &num, 0, SECSPERMIN);
if (strp == NULL)
return NULL;
*secsp += num;
@ -536,6 +597,7 @@ const long offset;
register int i;
int d, m1, yy0, yy1, yy2, dow;
INITIALIZE(value);
leapyear = isleap(year);
switch (rulep->r_type) {
@ -626,8 +688,8 @@ const int lastditch;
{
const char * stdname;
const char * dstname;
int stdlen;
int dstlen;
size_t stdlen;
size_t dstlen;
long stdoffset;
long dstoffset;
register time_t * atp;
@ -635,6 +697,7 @@ const int lastditch;
register char * cp;
register int load_result;
INITIALIZE(dstname);
stdname = name;
if (lastditch) {
stdlen = strlen(name); /* length of standard zone name */
@ -721,82 +784,88 @@ const int lastditch;
SECSPERDAY;
}
} else {
int sawstd;
int sawdst;
long stdfix;
long dstfix;
long oldfix;
int isdst;
register long theirstdoffset;
register long theirdstoffset;
register long theiroffset;
register int isdst;
register int i;
register int j;
if (*name != '\0')
return -1;
if (load_result != 0)
return -1;
/*
** Compute the difference between the real and
** prototype standard and summer time offsets
** from GMT, and put the real standard and summer
** time offsets into the rules in place of the
** prototype offsets.
** Initial values of theirstdoffset and theirdstoffset.
*/
sawstd = FALSE;
sawdst = FALSE;
stdfix = 0;
dstfix = 0;
for (i = 0; i < sp->typecnt; ++i) {
if (sp->ttis[i].tt_isdst) {
oldfix = dstfix;
dstfix = sp->ttis[i].tt_gmtoff +
dstoffset;
if (sawdst && (oldfix != dstfix))
return -1;
sp->ttis[i].tt_gmtoff = -dstoffset;
sp->ttis[i].tt_abbrind = stdlen + 1;
sawdst = TRUE;
} else {
oldfix = stdfix;
stdfix = sp->ttis[i].tt_gmtoff +
stdoffset;
if (sawstd && (oldfix != stdfix))
return -1;
sp->ttis[i].tt_gmtoff = -stdoffset;
sp->ttis[i].tt_abbrind = 0;
sawstd = TRUE;
theirstdoffset = 0;
for (i = 0; i < sp->timecnt; ++i) {
j = sp->types[i];
if (!sp->ttis[j].tt_isdst) {
theirstdoffset = -sp->ttis[j].tt_gmtoff;
break;
}
}
theirdstoffset = 0;
for (i = 0; i < sp->timecnt; ++i) {
j = sp->types[i];
if (sp->ttis[j].tt_isdst) {
theirdstoffset = -sp->ttis[j].tt_gmtoff;
break;
}
}
/*
** Make sure we have both standard and summer time.
** Initially we're assumed to be in standard time.
*/
if (!sawdst || !sawstd)
return -1;
isdst = FALSE;
theiroffset = theirstdoffset;
/*
** Now correct the transition times by shifting
** them by the difference between the real and
** prototype offsets. Note that this difference
** can be different in standard and summer time;
** the prototype probably has a 1-hour difference
** between standard and summer time, but a different
** difference can be specified in TZ.
** Now juggle transition times and types
** tracking offsets as you do.
*/
isdst = FALSE; /* we start in standard time */
for (i = 0; i < sp->timecnt; ++i) {
register const struct ttinfo * ttisp;
/*
** If summer time is in effect, and the
** transition time was not specified as
** standard time, add the summer time
** offset to the transition time;
** otherwise, add the standard time offset
** to the transition time.
*/
ttisp = &sp->ttis[sp->types[i]];
sp->ats[i] +=
(isdst && !ttisp->tt_ttisstd) ?
dstfix : stdfix;
isdst = ttisp->tt_isdst;
j = sp->types[i];
sp->types[i] = sp->ttis[j].tt_isdst;
if (sp->ttis[j].tt_ttisgmt) {
/* No adjustment to transition time */
} else {
/*
** If summer time is in effect, and the
** transition time was not specified as
** standard time, add the summer time
** offset to the transition time;
** otherwise, add the standard time
** offset to the transition time.
*/
/*
** Transitions from DST to DDST
** will effectively disappear since
** POSIX provides for only one DST
** offset.
*/
if (isdst && !sp->ttis[j].tt_ttisstd) {
sp->ats[i] += dstoffset -
theirdstoffset;
} else {
sp->ats[i] += stdoffset -
theirstdoffset;
}
}
theiroffset = -sp->ttis[j].tt_gmtoff;
if (sp->ttis[j].tt_isdst)
theirdstoffset = theiroffset;
else theirstdoffset = theiroffset;
}
/*
** Finally, fill in ttis.
** ttisstd and ttisgmt need not be handled.
*/
sp->ttis[0].tt_gmtoff = -stdoffset;
sp->ttis[0].tt_isdst = FALSE;
sp->ttis[0].tt_abbrind = 0;
sp->ttis[1].tt_gmtoff = -dstoffset;
sp->ttis[1].tt_isdst = TRUE;
sp->ttis[1].tt_abbrind = stdlen + 1;
}
} else {
dstlen = 0;
@ -826,17 +895,24 @@ static void
gmtload(sp)
struct state * const sp;
{
if (tzload(GMT, sp) != 0)
(void) tzparse(GMT, sp, TRUE);
if (tzload(gmt, sp) != 0)
(void) tzparse(gmt, sp, TRUE);
}
#ifndef STD_INSPIRED
/*
** A non-static declaration of tzsetwall in a system header file
** may cause a warning about this upcoming static declaration...
*/
static
#endif /* !defined STD_INSPIRED */
void
tzsetwall()
tzsetwall P((void))
{
lcl_is_set = TRUE;
if (lcl_is_set < 0)
return;
lcl_is_set = -1;
#ifdef ALL_STATE
if (lclptr == NULL) {
lclptr = (struct state *) malloc(sizeof *lclptr);
@ -852,7 +928,7 @@ tzsetwall()
}
void
tzset()
tzset P((void))
{
register const char * name;
@ -861,7 +937,13 @@ tzset()
tzsetwall();
return;
}
lcl_is_set = TRUE;
if (lcl_is_set > 0 && strcmp(lcl_TZname, name) == 0)
return;
lcl_is_set = (strlen(name) < sizeof(lcl_TZname));
if (lcl_is_set)
(void) strcpy(lcl_TZname, name);
#ifdef ALL_STATE
if (lclptr == NULL) {
lclptr = (struct state *) malloc(sizeof *lclptr);
@ -879,7 +961,7 @@ tzset()
lclptr->timecnt = 0;
lclptr->ttis[0].tt_gmtoff = 0;
lclptr->ttis[0].tt_abbrind = 0;
(void) strcpy(lclptr->chars, GMT);
(void) strcpy(lclptr->chars, gmt);
} else if (tzload(name, lclptr) != 0)
if (name[0] == ':' || tzparse(name, lclptr, FALSE) != 0)
(void) gmtload(lclptr);
@ -902,13 +984,11 @@ const time_t * const timep;
const long offset;
struct tm * const tmp;
{
register const struct state * sp;
register struct state * sp;
register const struct ttinfo * ttisp;
register int i;
const time_t t = *timep;
if (!lcl_is_set)
tzset();
sp = lclptr;
#ifdef ALL_STATE
if (sp == NULL) {
@ -938,9 +1018,9 @@ struct tm * const tmp;
*/
timesub(&t, ttisp->tt_gmtoff, sp, tmp);
tmp->tm_isdst = ttisp->tt_isdst;
tzname[tmp->tm_isdst] = (char *) &sp->chars[ttisp->tt_abbrind];
tzname[tmp->tm_isdst] = &sp->chars[ttisp->tt_abbrind];
#ifdef TM_ZONE
tmp->TM_ZONE = (char *)&sp->chars[ttisp->tt_abbrind];
tmp->TM_ZONE = &sp->chars[ttisp->tt_abbrind];
#endif /* defined TM_ZONE */
}
@ -948,8 +1028,7 @@ struct tm *
localtime(timep)
const time_t * const timep;
{
static struct tm tm;
tzset();
localsub(timep, 0L, &tm);
return &tm;
}
@ -980,11 +1059,11 @@ struct tm * const tmp;
** but this is no time for a treasure hunt.
*/
if (offset != 0)
tmp->TM_ZONE = WILDABBR;
tmp->TM_ZONE = wildabbr;
else {
#ifdef ALL_STATE
if (gmtptr == NULL)
tmp->TM_ZONE = GMT;
tmp->TM_ZONE = gmt;
else tmp->TM_ZONE = gmtptr->chars;
#endif /* defined ALL_STATE */
#ifndef ALL_STATE
@ -998,8 +1077,6 @@ struct tm *
gmtime(timep)
const time_t * const timep;
{
static struct tm tm;
gmtsub(timep, 0L, &tm);
return &tm;
}
@ -1011,8 +1088,6 @@ offtime(timep, offset)
const time_t * const timep;
const long offset;
{
static struct tm tm;
gmtsub(timep, offset, &tm);
return &tm;
}
@ -1074,7 +1149,7 @@ register struct tm * const tmp;
days = -24855;
rem = -11648;
}
#endif /* mc68k */
#endif /* defined mc68k */
rem += (offset - corr);
while (rem < 0) {
rem += SECSPERDAY;
@ -1127,6 +1202,12 @@ char *
ctime(timep)
const time_t * const timep;
{
/*
** Section 4.12.3.2 of X3.159-1989 requires that
** The ctime funciton converts the calendar time pointed to by timer
** to local time in the form of a string. It is equivalent to
** asctime(localtime(timer))
*/
return asctime(localtime(timep));
}
@ -1152,7 +1233,7 @@ increment_overflow(number, delta)
int * number;
int delta;
{
int number0;
int number0;
number0 = *number;
*number += delta;
@ -1193,7 +1274,7 @@ register const struct tm * const btmp;
static time_t
time2(tmp, funcp, offset, okayp)
struct tm * const tmp;
void (* const funcp)();
void (* const funcp) P((const time_t*, long, struct tm*));
const long offset;
int * const okayp;
{
@ -1338,7 +1419,7 @@ label:
static time_t
time1(tmp, funcp, offset)
struct tm * const tmp;
void (* const funcp)();
void (* const funcp) P((const time_t*, long, struct tm*));
const long offset;
{
register time_t t;
@ -1401,6 +1482,7 @@ time_t
mktime(tmp)
struct tm * const tmp;
{
tzset();
return time1(tmp, localsub, 0L);
}
@ -1475,8 +1557,6 @@ time_t * timep;
register struct lsinfo * lp;
register int i;
if (!lcl_is_set)
(void) tzset();
sp = lclptr;
i = sp->leapcnt;
while (--i >= 0) {
@ -1491,6 +1571,7 @@ time_t
time2posix(t)
time_t t;
{
tzset();
return t - leapcorr(&t);
}
@ -1501,6 +1582,7 @@ time_t t;
time_t x;
time_t y;
tzset();
/*
** For a positive leap second hit, the result
** is not unique. For a negative leap second

View File

@ -26,12 +26,59 @@
#ifndef lint
#ifndef NOID
static char privatehid[] = "@(#)private.h 7.5";
/*static char privatehid[] = "@(#)private.h 7.33";*/
#endif /* !defined NOID */
#endif /* !defined lint */
/*
** const
** Defaults for preprocessor symbols.
** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'.
*/
#ifndef HAVE_ADJTIME
#define HAVE_ADJTIME 1
#endif /* !defined HAVE_ADJTIME */
#ifndef HAVE_SETTIMEOFDAY
#define HAVE_SETTIMEOFDAY 3
#endif /* !defined HAVE_SETTIMEOFDAY */
#ifndef HAVE_UNISTD_H
#define HAVE_UNISTD_H 1
#endif /* !defined HAVE_UNISTD_H */
/*
** Nested includes
*/
#include "sys/types.h" /* for time_t */
#include "stdio.h"
#include "ctype.h"
#include "errno.h"
#include "string.h"
#include "limits.h" /* for CHAR_BIT */
#include "time.h"
#include "stdlib.h"
#if HAVE_UNISTD_H - 0
#include "unistd.h" /* for F_OK and R_OK */
#endif /* HAVE_UNISTD_H - 0 */
#if !(HAVE_UNISTD_H - 0)
#ifndef F_OK
#define F_OK 0
#endif /* !defined F_OK */
#ifndef R_OK
#define R_OK 4
#endif /* !defined R_OK */
#endif /* !(HAVE_UNISTD_H - 0) */
/*
** Workarounds for compilers/systems.
*/
/*
** SunOS 4.1.1 cc lacks const.
*/
#ifndef const
@ -41,21 +88,7 @@ static char privatehid[] = "@(#)private.h 7.5";
#endif /* !defined const */
/*
** void
*/
#ifndef void
#ifndef __STDC__
#ifndef vax
#ifndef sun
#define void char
#endif /* !defined sun */
#endif /* !defined vax */
#endif /* !defined __STDC__ */
#endif /* !defined void */
/*
** P((args))
** SunOS 4.1.1 cc lacks prototypes.
*/
#ifndef P
@ -63,36 +96,29 @@ static char privatehid[] = "@(#)private.h 7.5";
#define P(x) x
#endif /* defined __STDC__ */
#ifndef __STDC__
#define ASTERISK *
#define P(x) ( /ASTERISK x ASTERISK/ )
#define P(x) ()
#endif /* !defined __STDC__ */
#endif /* !defined P */
/*
** genericptr_t
** SunOS 4.1.1 headers lack EXIT_SUCCESS.
*/
#ifdef __STDC__
typedef void * genericptr_t;
#endif /* defined __STDC__ */
#ifndef __STDC__
typedef char * genericptr_t;
#endif /* !defined __STDC__ */
#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#endif /* !defined EXIT_SUCCESS */
#include "sys/types.h" /* for time_t */
#include "stdio.h"
#include "ctype.h"
#include "errno.h"
#include "string.h"
#include "limits.h" /* for CHAR_BIT */
#ifndef _TIME_
#include "time.h"
#endif /* !defined _TIME_ */
/*
** SunOS 4.1.1 headers lack EXIT_FAILURE.
*/
#ifndef remove
extern int unlink P((const char * filename));
#define remove unlink
#endif /* !defined remove */
#ifndef EXIT_FAILURE
#define EXIT_FAILURE 1
#endif /* !defined EXIT_FAILURE */
/*
** SunOS 4.1.1 headers lack FILENAME_MAX.
*/
#ifndef FILENAME_MAX
@ -111,62 +137,18 @@ extern int unlink P((const char * filename));
#endif /* !defined FILENAME_MAX */
#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#endif /* !defined EXIT_SUCCESS */
#ifndef EXIT_FAILURE
#define EXIT_FAILURE 1
#endif /* !defined EXIT_FAILURE */
#ifdef __STDC__
#define alloc_size_t size_t
#define qsort_size_t size_t
#define fwrite_size_t size_t
#endif /* defined __STDC__ */
#ifndef __STDC__
#ifndef alloc_size_t
#define alloc_size_t unsigned
#endif /* !defined alloc_size_t */
#ifndef qsort_size_t
#ifdef USG
#define qsort_size_t unsigned
#endif /* defined USG */
#ifndef USG
#define qsort_size_t int
#endif /* !defined USG */
#endif /* !defined qsort_size_t */
#ifndef fwrite_size_t
#define fwrite_size_t int
#endif /* !defined fwrite_size_t */
#ifndef USG
extern char * sprintf P((char * buf, const char * format, ...));
#endif /* !defined USG */
#endif /* !defined __STDC__ */
/*
** Ensure that these are declared--redundantly declaring them shouldn't hurt.
** SunOS 4.1.1 libraries lack remove.
*/
extern char * getenv P((const char * name));
extern genericptr_t malloc P((alloc_size_t size));
extern genericptr_t calloc P((alloc_size_t nelem, alloc_size_t elsize));
extern genericptr_t realloc P((genericptr_t oldptr, alloc_size_t newsize));
#ifndef remove
extern int unlink P((const char * filename));
#define remove unlink
#endif /* !defined remove */
#ifdef USG
extern void exit P((int s));
extern void qsort P((genericptr_t base, qsort_size_t nelem,
qsort_size_t elsize, int (*comp)()));
extern void perror P((const char * string));
extern void free P((char * buf));
#endif /* defined USG */
/*
** Finally, some convenience items.
*/
#ifndef TRUE
#define TRUE 1
@ -188,8 +170,31 @@ extern void free P((char * buf));
#endif /* !defined INT_STRLEN_MAXIMUM */
/*
** UNIX is a registered trademark of AT&T.
** VAX is a trademark of Digital Equipment Corporation.
** INITIALIZE(x)
*/
#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 */
/*
** UNIX was a registered trademark of UNIX System Laboratories in 1993.
*/
#endif /* !defined PRIVATE_H */

View File

@ -16,7 +16,7 @@
#ifndef lint
#ifndef NOID
static char tzfilehid[] = "@(#)tzfile.h 7.4";
/*static char tzfilehid[] = "@(#)tzfile.h 7.6";*/
#endif /* !defined NOID */
#endif /* !defined lint */
@ -41,7 +41,8 @@ static char tzfilehid[] = "@(#)tzfile.h 7.4";
*/
struct tzhead {
char tzh_reserved[24]; /* reserved for future use */
char tzh_reserved[20]; /* reserved for future use */
char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */
char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */
char tzh_leapcnt[4]; /* coded number of leap seconds */
char tzh_timecnt[4]; /* coded number of transition times */
@ -67,6 +68,11 @@ struct tzhead {
** transition time is wall clock time
** if absent, transition times are
** assumed to be wall clock time
** tzh_ttisgmtcnt (char)s indexed by type; if TRUE, transition
** time is GMT, if FALSE,
** transition time is local time
** if absent, transition times are
** assumed to be local time
*/
/*
@ -89,7 +95,11 @@ struct tzhead {
#define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */
#endif /* !defined NOSOLAR */
#ifdef NOSOLAR
#define TZ_MAX_TYPES 10 /* Maximum number of local time types */
/*
** Must be at least 14 for Europe/Riga as of Jan 12 1995,
** as noted by Earl Chew <earl@hpato.aus.hp.com>.
*/
#define TZ_MAX_TYPES 20 /* Maximum number of local time types */
#endif /* !defined NOSOLAR */
#endif /* !defined TZ_MAX_TYPES */