sync with tzcode1997g

This commit is contained in:
jtc 1997-09-05 02:11:55 +00:00
parent 2080f3c806
commit 0f031182c5
3 changed files with 39 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: localtime.c,v 1.12 1997/07/21 14:09:20 jtc Exp $ */
/* $NetBSD: localtime.c,v 1.13 1997/09/05 02:11:55 jtc Exp $ */
/*
** This file is in the public domain, so clarified as of
@ -9,9 +9,9 @@
#ifndef lint
#ifndef NOID
#if 0
static char elsieid[] = "@(#)localtime.c 7.61";
static char elsieid[] = "@(#)localtime.c 7.62";
#else
__RCSID("$NetBSD: localtime.c,v 1.12 1997/07/21 14:09:20 jtc Exp $");
__RCSID("$NetBSD: localtime.c,v 1.13 1997/09/05 02:11:55 jtc Exp $");
#endif
#endif /* !defined NOID */
#endif /* !defined lint */
@ -153,6 +153,10 @@ static time_t time2 P((struct tm *tmp,
void(*funcp) P((const time_t *,
long, struct tm*)),
long offset, int * okayp));
static time_t time2sub P((struct tm *tmp,
void(*funcp) P((const time_t *,
long, struct tm*)),
long offset, int * okayp, int do_norm_secs));
static void timesub P((const time_t * timep, long offset,
const struct state * sp, struct tm * tmp));
static int tmcomp P((const struct tm * atmp,
@ -1318,11 +1322,12 @@ register const struct tm * const btmp;
}
static time_t
time2(tmp, funcp, offset, okayp)
time2sub(tmp, funcp, offset, okayp, do_norm_secs)
struct tm * const tmp;
void (* const funcp) P((const time_t*, long, struct tm*));
const long offset;
int * const okayp;
const int do_norm_secs;
{
register const struct state * sp;
register int dir;
@ -1335,6 +1340,11 @@ int * const okayp;
*okayp = FALSE;
yourtm = *tmp;
if (do_norm_secs) {
if (normalize_overflow(&yourtm.tm_min, &yourtm.tm_sec,
SECSPERMIN))
return WRONG;
}
if (normalize_overflow(&yourtm.tm_hour, &yourtm.tm_min, MINSPERHOUR))
return WRONG;
if (normalize_overflow(&yourtm.tm_mday, &yourtm.tm_hour, HOURSPERDAY))
@ -1463,6 +1473,24 @@ label:
return t;
}
static time_t
time2(tmp, funcp, offset, okayp)
struct tm * const tmp;
void (* const funcp) P((const time_t*, long, struct tm*));
const long offset;
int * const okayp;
{
time_t t;
/*
** First try without normalization of seconds
** (in case tm_sec contains a value associated with a leap second).
** If that fails, try with normalization of seconds.
*/
t = time2sub(tmp, funcp, offset, okayp, FALSE);
return *okayp ? t : time2sub(tmp, funcp, offset, okayp, TRUE);
}
static time_t
time1(tmp, funcp, offset)
struct tm * const tmp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: private.h,v 1.9 1997/07/13 20:26:51 christos Exp $ */
/* $NetBSD: private.h,v 1.10 1997/09/05 02:11:57 jtc Exp $ */
#ifndef PRIVATE_H
#define PRIVATE_H
@ -29,7 +29,7 @@
#ifndef lint
#ifndef NOID
#if 0
static char privatehid[] = "@(#)private.h 7.45";
static char privatehid[] = "@(#)private.h 7.46";
#endif
#endif /* !defined NOID */
#endif /* !defined lint */
@ -191,7 +191,7 @@ char * imalloc P((int n));
void * irealloc P((void * pointer, int size));
void icfree P((char * pointer));
void ifree P((char * pointer));
char * scheck P((const char *string, char *format));
char * scheck P((const char *string, const char *format));
/*

View File

@ -1,12 +1,12 @@
/* $NetBSD: scheck.c,v 1.5 1997/07/13 20:26:52 christos Exp $ */
/* $NetBSD: scheck.c,v 1.6 1997/09/05 02:11:58 jtc Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#ifndef NOID
#if 0
static char elsieid[] = "@(#)scheck.c 8.14";
static char elsieid[] = "@(#)scheck.c 8.15";
#else
__RCSID("$NetBSD: scheck.c,v 1.5 1997/07/13 20:26:52 christos Exp $");
__RCSID("$NetBSD: scheck.c,v 1.6 1997/09/05 02:11:58 jtc Exp $");
#endif
#endif /* !defined lint */
#endif /* !defined NOID */
@ -18,7 +18,7 @@ __RCSID("$NetBSD: scheck.c,v 1.5 1997/07/13 20:26:52 christos Exp $");
char *
scheck(string, format)
const char * const string;
char * const format;
const char * const format;
{
register char * fbuf;
register const char * fp;