typeof(timeval.ts_sec) != time_t

This commit is contained in:
cgd 1995-06-07 16:29:30 +00:00
parent dcb82cbdbc
commit 8936958f57
2 changed files with 13 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: print.c,v 1.23 1995/05/25 04:13:17 mycroft Exp $ */ /* $NetBSD: print.c,v 1.24 1995/06/07 16:29:30 cgd Exp $ */
/*- /*-
* Copyright (c) 1990, 1993, 1994 * Copyright (c) 1990, 1993, 1994
@ -37,7 +37,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94"; static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94";
#else #else
static char rcsid[] = "$NetBSD: print.c,v 1.23 1995/05/25 04:13:17 mycroft Exp $"; static char rcsid[] = "$NetBSD: print.c,v 1.24 1995/06/07 16:29:30 cgd Exp $";
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -381,6 +381,7 @@ started(k, ve)
{ {
VAR *v; VAR *v;
static time_t now; static time_t now;
time_t startt;
struct tm *tp; struct tm *tp;
char buf[100]; char buf[100];
@ -390,7 +391,8 @@ started(k, ve)
return; return;
} }
tp = localtime(&k->ki_u.u_start.tv_sec); startt = k->ki_u.u_start.tv_sec;
tp = localtime(&startt);
if (!now) if (!now)
(void)time(&now); (void)time(&now);
if (now - k->ki_u.u_start.tv_sec < 24 * SECSPERHOUR) { if (now - k->ki_u.u_start.tv_sec < 24 * SECSPERHOUR) {
@ -412,6 +414,7 @@ lstarted(k, ve)
VARENT *ve; VARENT *ve;
{ {
VAR *v; VAR *v;
time_t startt;
char buf[100]; char buf[100];
v = ve->var; v = ve->var;
@ -419,8 +422,9 @@ lstarted(k, ve)
(void)printf("%-*s", v->width, "-"); (void)printf("%-*s", v->width, "-");
return; return;
} }
startt = k->ki_u.u_start.tv_sec;
(void)strftime(buf, sizeof(buf) -1, "%C", (void)strftime(buf, sizeof(buf) -1, "%C",
localtime(&k->ki_u.u_start.tv_sec)); localtime(&startt));
(void)printf("%-*s", v->width, buf); (void)printf("%-*s", v->width, buf);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: pom.c,v 1.4 1995/03/23 08:35:36 cgd Exp $ */ /* $NetBSD: pom.c,v 1.5 1995/06/07 16:30:46 cgd Exp $ */
/* /*
* Copyright (c) 1989, 1993 * Copyright (c) 1989, 1993
@ -45,7 +45,7 @@ static char copyright[] =
#if 0 #if 0
static char sccsid[] = "@(#)pom.c 8.1 (Berkeley) 5/31/93"; static char sccsid[] = "@(#)pom.c 8.1 (Berkeley) 5/31/93";
#else #else
static char rcsid[] = "$NetBSD: pom.c,v 1.4 1995/03/23 08:35:36 cgd Exp $"; static char rcsid[] = "$NetBSD: pom.c,v 1.5 1995/06/07 16:30:46 cgd Exp $";
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -82,6 +82,7 @@ main()
struct timeval tp; struct timeval tp;
struct timezone tzp; struct timezone tzp;
struct tm *GMT, *gmtime(); struct tm *GMT, *gmtime();
time_t tmpt;
double days, today, tomorrow; double days, today, tomorrow;
int cnt; int cnt;
@ -89,7 +90,8 @@ main()
(void)fprintf(stderr, "pom: %s\n", strerror(errno)); (void)fprintf(stderr, "pom: %s\n", strerror(errno));
exit(1); exit(1);
} }
GMT = gmtime(&tp.tv_sec); tmpt = tp.tv_sec;
GMT = gmtime(&tmpt);
days = (GMT->tm_yday + 1) + ((GMT->tm_hour + days = (GMT->tm_yday + 1) + ((GMT->tm_hour +
(GMT->tm_min / 60.0) + (GMT->tm_sec / 3600.0)) / 24.0); (GMT->tm_min / 60.0) + (GMT->tm_sec / 3600.0)) / 24.0);
for (cnt = EPOCH; cnt < GMT->tm_year; ++cnt) for (cnt = EPOCH; cnt < GMT->tm_year; ++cnt)