dect
/
asterisk
Archived
13
0
Fork 0

Merged revisions 82285 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r82285 | tilghman | 2007-09-12 15:12:06 -0500 (Wed, 12 Sep 2007) | 4 lines

Working on issue #10531 exposed a rather nasty 64-bit issue on ast_mktime, so we
updated the localtime.c file from source.  Next we'll have to write ast_strptime
to match.

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@82290 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
tilghman 2007-09-12 21:25:57 +00:00
parent e6abcba2f2
commit 21583e9453
6 changed files with 996 additions and 716 deletions

View File

@ -202,7 +202,7 @@ typedef struct sms_s {
char queue[30]; /*!< queue name */
char oa[20]; /*!< originating address */
char da[20]; /*!< destination address */
time_t scts; /*!< time stamp, UTC */
struct timeval scts; /*!< time stamp, UTC */
unsigned char pid; /*!< protocol ID */
unsigned char dcs; /*!< data coding scheme */
short mr; /*!< message reference - actually a byte, but use -1 for not set */
@ -766,7 +766,7 @@ static void sms_readfile(sms_t * h, char *fn)
h->rx = h->udl = *h->oa = *h->da = h->pid = h->srr = h->udhi = h->rp = h->vp = h->udhl = 0;
h->mr = -1;
h->dcs = 0xF1; /* normal messages class 1 */
h->scts = time(NULL);
h->scts = ast_tvnow();
s = fopen(fn, "r");
if (s) {
if (unlink(fn)) { /* concurrent access, we lost */
@ -825,7 +825,7 @@ static void sms_readfile(sms_t * h, char *fn)
M,
S;
if (sscanf (p, "%d-%d-%dT%d:%d:%d", &Y, &m, &d, &H, &M, &S) == 6) {
struct tm t;
struct ast_tm t = { 0, };
t.tm_year = Y - 1900;
t.tm_mon = m - 1;
t.tm_mday = d;
@ -833,8 +833,8 @@ static void sms_readfile(sms_t * h, char *fn)
t.tm_min = M;
t.tm_sec = S;
t.tm_isdst = -1;
h->scts = mktime(&t);
if (h->scts == (time_t) - 1)
h->scts = ast_mktime(&t, NULL);
if (h->scts.tv_sec == 0)
ast_log(LOG_WARNING, "Bad date/timein %s: %s", fn, p);
}
} else
@ -925,7 +925,7 @@ static void sms_writefile(sms_t * h)
snprintf(fn, sizeof(fn), "%s/sms/%s", ast_config_AST_SPOOL_DIR, h->smsc ? h->rx ? "morx" : "mttx" : h->rx ? "mtrx" : "motx");
ast_mkdir(fn, 0777); /* ensure it exists */
ast_copy_string(fn2, fn, sizeof(fn2));
snprintf(fn2 + strlen(fn2), sizeof(fn2) - strlen(fn2), "/%s.%s-%d", h->queue, isodate(h->scts, buf, sizeof(buf)), seq++);
snprintf(fn2 + strlen(fn2), sizeof(fn2) - strlen(fn2), "/%s.%s-%d", h->queue, isodate(h->scts.tv_sec, buf, sizeof(buf)), seq++);
snprintf(fn + strlen(fn), sizeof(fn) - strlen(fn), "/.%s", fn2 + strlen(fn) + 1);
o = fopen(fn, "w");
if (o == NULL)
@ -982,9 +982,9 @@ static void sms_writefile(sms_t * h)
}
}
}
if (h->scts) {
if (h->scts.tv_sec) {
char buf[30];
fprintf(o, "scts=%s\n", isodate(h->scts, buf, sizeof(buf)));
fprintf(o, "scts=%s\n", isodate(h->scts.tv_sec, buf, sizeof(buf)));
}
if (h->pid)
fprintf(o, "pid=%d\n", h->pid);
@ -1027,7 +1027,7 @@ static unsigned char sms_handleincoming (sms_t * h)
h->udhi = ((h->imsg[2] & 0x40) ? 1 : 0);
h->rp = ((h->imsg[2] & 0x80) ? 1 : 0);
ast_copy_string(h->oa, h->cli, sizeof(h->oa));
h->scts = time(NULL);
h->scts = ast_tvnow();
h->mr = h->imsg[p++];
p += unpackaddress(h->da, h->imsg + p);
h->pid = h->imsg[p++];
@ -1065,7 +1065,7 @@ static unsigned char sms_handleincoming (sms_t * h)
p += unpackaddress(h->oa, h->imsg + p);
h->pid = h->imsg[p++];
h->dcs = h->imsg[p++];
h->scts = unpackdate(h->imsg + p);
h->scts.tv_sec = unpackdate(h->imsg + p);
p += 7;
p += unpacksms(h->dcs, h->imsg + p, h->udh, &h->udhl, h->ud, &h->udl, h->udhi);
h->rx = 1; /* received message */
@ -1116,7 +1116,7 @@ static void putdummydata_proto2(sms_t *h)
static void sms_compose2(sms_t *h, int more)
{
struct ast_tm tm;
struct timeval tv = { h->scts, 0 };
struct timeval tv = h->scts;
char stm[9];
h->omsg[0] = 0x00; /* set later... */
@ -1171,7 +1171,7 @@ static int sms_handleincoming_proto2(sms_t *h)
/* ast_verb(3, "SMS-P2 Frame: %s\n", sms_hexdump(h->imsg, sz, debug_buf)); */
/* Parse message body (called payload) */
tv.tv_sec = h->scts = time(NULL);
tv = h->scts = ast_tvnow();
for (f = 4; f < sz; ) {
msg = h->imsg[f++];
msgsz = h->imsg[f++];
@ -1186,7 +1186,7 @@ static int sms_handleincoming_proto2(sms_t *h)
h->udl = msgsz;
break;
case 0x14: /* Date SCTS */
tv.tv_sec = h->scts = time(NULL);
tv = h->scts = ast_tvnow();
ast_localtime(&tv, &tm, NULL);
tm.tm_mon = ( (h->imsg[f] * 10) + h->imsg[f + 1] ) - 1;
tm.tm_mday = ( (h->imsg[f + 2] * 10) + h->imsg[f + 3] );
@ -1302,7 +1302,7 @@ static void sms_compose1(sms_t *h, int more)
p += packaddress(h->omsg + p, h->oa);
h->omsg[p++] = h->pid;
h->omsg[p++] = h->dcs;
packdate(h->omsg + p, h->scts);
packdate(h->omsg + p, h->scts.tv_sec);
p += 7;
p += packsms(h->dcs, h->omsg + p, h->udhl, h->udh, h->udl, h->ud);
} else { /* submit */
@ -1823,7 +1823,7 @@ static int sms_exec(struct ast_channel *chan, void *data)
/* submitting a message, not taking call. */
/* deprecated, use smsq instead */
h.scts = time(NULL);
h.scts = ast_tvnow();
if (ast_strlen_zero(sms_args.addr) || strlen(sms_args.addr) >= sizeof(h.oa)) {
ast_log(LOG_ERROR, "Address too long %s\n", sms_args.addr);
goto done;

View File

@ -659,7 +659,8 @@ static int acf_strptime(struct ast_channel *chan, const char *cmd, char *data,
if (!strptime(args.timestring, args.format, &t.time)) {
ast_log(LOG_WARNING, "C function strptime() output nothing?!!\n");
} else {
snprintf(buf, len, "%d", (int) ast_mktime(&t.atm, args.timezone));
struct timeval tv = ast_mktime(&t.atm, args.timezone);
snprintf(buf, len, "%d", (int) tv.tv_sec);
}
return 0;

View File

@ -40,11 +40,8 @@ struct ast_tm {
int tm_usec; /* microseconds */
};
int ast_tzsetwall(void);
void ast_tzset(const char *name);
struct ast_tm *ast_localtime(const struct timeval *timep, struct ast_tm *p_tm, const char *zone);
time_t ast_mktime(struct ast_tm * const tmp, const char *zone);
char *ast_ctime(const struct timeval * const timep, char *buf);
struct timeval ast_mktime(struct ast_tm * const tmp, const char *zone);
int ast_strftime(char *buf, size_t len, const char *format, const struct ast_tm *tm);
#endif /* _ASTERISK_LOCALTIME_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,32 +1,12 @@
/* $FreeBSD: src/lib/libc/stdtime/private.h,v 1.6.8.1 2000/08/23 00:19:15 jhb Exp $ */
#ifndef PRIVATE_H
#define PRIVATE_H
/*
** This file is in the public domain, so clarified as of
** June 5, 1996 by Arthur David Olson (arthur_david_olson@nih.gov).
** 1996-06-05 by Arthur David Olson.
*/
/* Stuff moved from Makefile.inc to reduce clutter */
#ifndef __CYGWIN__
#ifndef TM_GMTOFF
#define TM_GMTOFF tm_gmtoff
#define TM_ZONE tm_zone
#endif
#define STD_INSPIRED 1
#define PCTS 1
#define HAVE_LONG_DOUBLE 1
#define HAVE_STRERROR 1
#define HAVE_UNISTD_H 1
#define LOCALE_HOME _PATH_LOCALE
#ifdef SOLARIS
#define TZDIR "/usr/share/lib/zoneinfo"
#else
#define TZDIR "/usr/share/zoneinfo"
#endif /* def SOLARIS */
#endif /* ndef TM_GMTOFF */
/*
** This header is for use ONLY with the time conversion code.
** There is no guarantee that it will remain unchanged,
@ -41,12 +21,12 @@
#ifndef lint
#ifndef NOID
/*
static char privatehid[] = "@(#)private.h 7.43";
*/
static char __attribute__((unused)) privatehid[] = "@(#)private.h 8.3";
#endif /* !defined NOID */
#endif /* !defined lint */
#define GRANDPARENTED "Local time zone must be set--see zic manual page"
/*
** Defaults for preprocessor symbols.
** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'.
@ -60,14 +40,30 @@ static char privatehid[] = "@(#)private.h 7.43";
#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
#define HAVE_SYMLINK 1
#endif /* !defined HAVE_SYMLINK */
#ifndef HAVE_SYS_STAT_H
#define HAVE_SYS_STAT_H 1
#endif /* !defined HAVE_SYS_STAT_H */
#ifndef HAVE_SYS_WAIT_H
#define HAVE_SYS_WAIT_H 1
#endif /* !defined HAVE_SYS_WAIT_H */
#ifndef HAVE_UNISTD_H
#define HAVE_UNISTD_H 1
#endif /* !defined HAVE_UNISTD_H */
@ -80,6 +76,11 @@ static char privatehid[] = "@(#)private.h 7.43";
#define LOCALE_HOME "/usr/lib/locale"
#endif /* !defined LOCALE_HOME */
#if HAVE_INCOMPATIBLE_CTIME_R
#define asctime_r _incompatible_asctime_r
#define ctime_r _incompatible_ctime_r
#endif /* HAVE_INCOMPATIBLE_CTIME_R */
/*
** Nested includes
*/
@ -88,43 +89,105 @@ static char privatehid[] = "@(#)private.h 7.43";
#include "stdio.h"
#include "errno.h"
#include "string.h"
#include "limits.h" /* for CHAR_BIT */
#include "limits.h" /* for CHAR_BIT et al. */
#include "time.h"
#include "stdlib.h"
#if HAVE_GETTEXT - 0
#if HAVE_GETTEXT
#include "libintl.h"
#endif /* HAVE_GETTEXT - 0 */
#endif /* HAVE_GETTEXT */
#if HAVE_UNISTD_H - 0
#if HAVE_SYS_WAIT_H
#include <sys/wait.h> /* for WIFEXITED and WEXITSTATUS */
#endif /* HAVE_SYS_WAIT_H */
#ifndef WIFEXITED
#define WIFEXITED(status) (((status) & 0xff) == 0)
#endif /* !defined WIFEXITED */
#ifndef WEXITSTATUS
#define WEXITSTATUS(status) (((status) >> 8) & 0xff)
#endif /* !defined WEXITSTATUS */
#if HAVE_UNISTD_H
#include "unistd.h" /* for F_OK and R_OK */
#endif /* HAVE_UNISTD_H - 0 */
#endif /* HAVE_UNISTD_H */
#if !(HAVE_UNISTD_H - 0)
#if !HAVE_UNISTD_H
#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) */
#endif /* !HAVE_UNISTD_H */
/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
#define is_digit(c) ((unsigned)(c) - '0' <= 9)
/*
** Define HAVE_STDINT_H's default value here, rather than at the
** start, since __GLIBC__'s value depends on previously-included
** files.
** (glibc 2.1 and later have stdint.h, even with pre-C99 compilers.)
*/
#ifndef HAVE_STDINT_H
#define HAVE_STDINT_H \
(199901 <= __STDC_VERSION__ || \
2 < (__GLIBC__ + (0 < __GLIBC_MINOR__)))
#endif /* !defined HAVE_STDINT_H */
#if HAVE_STDINT_H
#include "stdint.h"
#endif /* !HAVE_STDINT_H */
#ifndef INT_FAST64_MAX
/* Pre-C99 GCC compilers define __LONG_LONG_MAX__ instead of LLONG_MAX. */
#if defined LLONG_MAX || defined __LONG_LONG_MAX__
typedef long long int_fast64_t;
#else /* ! (defined LLONG_MAX || defined __LONG_LONG_MAX__) */
#if (LONG_MAX >> 31) < 0xffffffff
Please use a compiler that supports a 64-bit integer type (or wider);
you may need to compile with "-DHAVE_STDINT_H".
#endif /* (LONG_MAX >> 31) < 0xffffffff */
typedef long int_fast64_t;
#endif /* ! (defined LLONG_MAX || defined __LONG_LONG_MAX__) */
#endif /* !defined INT_FAST64_MAX */
#ifndef INT32_MAX
#define INT32_MAX 0x7fffffff
#endif /* !defined INT32_MAX */
#ifndef INT32_MIN
#define INT32_MIN (-1 - INT32_MAX)
#endif /* !defined INT32_MIN */
/*
** Workarounds for compilers/systems.
*/
/*
** If your compiler lacks prototypes, "#define P(x) ()".
*/
#ifndef P
#ifdef __STDC__
#define P(x) x
#endif /* defined __STDC__ */
#ifndef __STDC__
#define P(x) ()
#endif /* !defined __STDC__ */
#endif /* !defined P */
/*
** SunOS 4.1.1 headers lack EXIT_SUCCESS.
*/
#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#endif /* !defined EXIT_SUCCESS */
/*
** SunOS 4.1.1 headers lack EXIT_FAILURE.
*/
#ifndef EXIT_FAILURE
#define EXIT_FAILURE 1
#endif /* !defined EXIT_FAILURE */
/*
** SunOS 4.1.1 headers lack FILENAME_MAX.
*/
@ -146,6 +209,38 @@ static char privatehid[] = "@(#)private.h 7.43";
#endif /* !defined FILENAME_MAX */
/*
** SunOS 4.1.1 libraries lack remove.
*/
#ifndef remove
extern int unlink P((const char * filename));
#define remove unlink
#endif /* !defined remove */
/*
** Some ancient errno.h implementations don't declare errno.
** But some newer errno.h implementations define it as a macro.
** Fix the former without affecting the latter.
*/
#ifndef errno
extern int errno;
#endif /* !defined errno */
/*
** Private function declarations.
*/
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));
void * irealloc P((void * pointer, int size));
void icfree P((char * pointer));
void ifree P((char * pointer));
const char * scheck P((const char * string, const char * format));
/*
** Finally, some convenience items.
*/
@ -166,6 +261,15 @@ static char privatehid[] = "@(#)private.h 7.43";
#define TYPE_SIGNED(type) (((type) -1) < 0)
#endif /* !defined TYPE_SIGNED */
/*
** Since the definition of TYPE_INTEGRAL contains floating point numbers,
** it cannot be used in preprocessor directives.
*/
#ifndef TYPE_INTEGRAL
#define TYPE_INTEGRAL(type) (((type) 0.5) != 0.5)
#endif /* !defined TYPE_INTEGRAL */
#ifndef INT_STRLEN_MAXIMUM
/*
** 302 / 1000 is log10(2.0) rounded up.
@ -174,7 +278,8 @@ static char privatehid[] = "@(#)private.h 7.43";
** add one more for a minus sign if the type is signed.
*/
#define INT_STRLEN_MAXIMUM(type) \
((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + 1 + TYPE_SIGNED(type))
((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + \
1 + TYPE_SIGNED(type))
#endif /* !defined INT_STRLEN_MAXIMUM */
/*
@ -208,19 +313,46 @@ static char privatehid[] = "@(#)private.h 7.43";
*/
#ifndef _
#if HAVE_GETTEXT - 0
#if HAVE_GETTEXT
#define _(msgid) gettext(msgid)
#else /* !(HAVE_GETTEXT - 0) */
#else /* !HAVE_GETTEXT */
#define _(msgid) msgid
#endif /* !(HAVE_GETTEXT - 0) */
#endif /* !HAVE_GETTEXT */
#endif /* !defined _ */
#ifndef TZ_DOMAIN
#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 */
#ifndef YEARSPERREPEAT
#define YEARSPERREPEAT 400 /* years before a Gregorian repeat */
#endif /* !defined YEARSPERREPEAT */
/*
** UNIX was a registered trademark of UNIX System Laboratories in 1993.
** The Gregorian year averages 365.2425 days, which is 31556952 seconds.
*/
#ifndef AVGSECSPERYEAR
#define AVGSECSPERYEAR 31556952L
#endif /* !defined AVGSECSPERYEAR */
#ifndef SECSPERREPEAT
#define SECSPERREPEAT ((int_fast64_t) YEARSPERREPEAT * (int_fast64_t) AVGSECSPERYEAR)
#endif /* !defined SECSPERREPEAT */
#ifndef SECSPERREPEAT_BITS
#define SECSPERREPEAT_BITS 34 /* ceil(log2(SECSPERREPEAT)) */
#endif /* !defined SECSPERREPEAT_BITS */
/*
** UNIX was a registered trademark of The Open Group in 2003.
*/
#endif /* !defined PRIVATE_H */

View File

@ -2,17 +2,18 @@
#define TZFILE_H
/*! \brief
* This file is in the public domain, so clarified as of
* 1996-06-05 by
* \author Arthur David Olson (arthur_david_olson@nih.gov).
*
* \note This header is for use ONLY with the time conversion code.
* There is no guarantee that it will remain unchanged,
* or that it will remain at all.
* Do NOT copy it to any system include directory.
* Thank you!
*/
/*
** This file is in the public domain, so clarified as of
** 1996-06-05 by Arthur David Olson.
*/
/*
** This header is for use ONLY with the time conversion code.
** There is no guarantee that it will remain unchanged,
** or that it will remain at all.
** Do NOT copy it to any system include directory.
** Thank you!
*/
/*
** ID
@ -20,9 +21,7 @@
#ifndef lint
#ifndef NOID
/*
static char tzfilehid[] = "@(#)tzfile.h 7.14";
*/
static char __attribute__((unused)) tzfilehid[] = "@(#)tzfile.h 8.1";
#endif /* !defined NOID */
#endif /* !defined lint */
@ -31,11 +30,19 @@ static char tzfilehid[] = "@(#)tzfile.h 7.14";
*/
#ifndef TZDIR
#define TZDIR "/usr/share/zoneinfo" /*!< Time zone object file directory */
#ifdef SOLARIS
#define TZDIR "/usr/share/lib/zoneinfo"
#else
#ifdef FREEBSD
#define TZDIR "/usr/local/etc/zoneinfo" /* Time zone object file directory */
#else
#define TZDIR "/usr/share/zoneinfo"
#endif /* defined FREEBSD */
#endif /* defined SOLARIS */
#endif /* !defined TZDIR */
#ifndef TZDEFAULT
#define TZDEFAULT "/etc/localtime"
#define TZDEFAULT "localtime"
#endif /* !defined TZDEFAULT */
#ifndef TZDEFRULES
@ -49,8 +56,9 @@ static char tzfilehid[] = "@(#)tzfile.h 7.14";
#define TZ_MAGIC "TZif"
struct tzhead {
char tzh_magic[4]; /* TZ_MAGIC */
char tzh_reserved[16]; /* reserved for future use */
char tzh_magic[4]; /* TZ_MAGIC */
char tzh_version[1]; /* '\0' or '2' as of 2005 */
char tzh_reserved[15]; /* reserved--must be zero */
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 */
@ -84,19 +92,23 @@ struct tzhead {
** assumed to be local time
*/
/*
** If tzh_version is '2' or greater, the above is followed by a second instance
** of tzhead and a second instance of the data in which each coded transition
** time uses 8 rather than 4 chars,
** then a POSIX-TZ-environment-variable-style string for use in handling
** instants after the last transition time stored in the file
** (with nothing between the newlines if there is no POSIX representation for
** such instants).
*/
/*
** In the current implementation, "tzset()" refuses to deal with files that
** exceed any of the limits below.
*/
#ifndef TZ_MAX_TIMES
/*
** The TZ_MAX_TIMES value below is enough to handle a bit more than a
** year's worth of solar time (corrected daily to the nearest second) or
** 138 years of Pacific Presidential Election time
** (where there are three time zone transitions every fourth year).
*/
#define TZ_MAX_TIMES 370
#define TZ_MAX_TIMES 1200
#endif /* !defined TZ_MAX_TIMES */
#ifndef TZ_MAX_TYPES
@ -106,7 +118,7 @@ struct tzhead {
#ifdef NOSOLAR
/*
** Must be at least 14 for Europe/Riga as of Jan 12 1995,
** as noted by Earl Chew <earl@hpato.aus.hp.com>.
** as noted by Earl Chew.
*/
#define TZ_MAX_TYPES 20 /* Maximum number of local time types */
#endif /* !defined NOSOLAR */
@ -157,33 +169,20 @@ struct tzhead {
#define EPOCH_YEAR 1970
#define EPOCH_WDAY TM_THURSDAY
/*
** Accurate only for the past couple of centuries;
** that will probably do.
*/
#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
#ifndef USG
/*
** Use of the underscored variants may cause problems if you move your code to
** certain System-V-based systems; for maximum portability, use the
** underscore-free variants. The underscored variants are provided for
** backward compatibility only; they may disappear from future versions of
** this file.
** Since everything in isleap is modulo 400 (or a factor of 400), we know that
** isleap(y) == isleap(y % 400)
** and so
** isleap(a + b) == isleap((a + b) % 400)
** or
** isleap(a + b) == isleap(a % 400 + b % 400)
** This is true even if % means modulo rather than Fortran remainder
** (which is allowed by C89 but not C99).
** We use this to avoid addition overflow problems.
*/
#define SECS_PER_MIN SECSPERMIN
#define MINS_PER_HOUR MINSPERHOUR
#define HOURS_PER_DAY HOURSPERDAY
#define DAYS_PER_WEEK DAYSPERWEEK
#define DAYS_PER_NYEAR DAYSPERNYEAR
#define DAYS_PER_LYEAR DAYSPERLYEAR
#define SECS_PER_HOUR SECSPERHOUR
#define SECS_PER_DAY SECSPERDAY
#define MONS_PER_YEAR MONSPERYEAR
#endif /* !defined USG */
#define isleap_sum(a, b) isleap((a) % 400 + (b) % 400)
#endif /* !defined TZFILE_H */