diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-04-08 01:11:23 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-04-08 01:11:23 +0000 |
commit | fbc353ceeeb7951583c2c95d4e8e209c3253a431 (patch) | |
tree | dcb26ae53c4c712c1bc6c5c407d8c1c484ff2d07 | |
parent | 49d2f3fa3f28f59974356f9256569c156a6e2659 (diff) |
on RAMDISK kernels, do not compare / time against the system time
-rw-r--r-- | sys/arch/sparc/sparc/clock.c | 14 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/clock.c | 17 |
2 files changed, 23 insertions, 8 deletions
diff --git a/sys/arch/sparc/sparc/clock.c b/sys/arch/sparc/sparc/clock.c index 82b8eb64472..7a50adfdd8f 100644 --- a/sys/arch/sparc/sparc/clock.c +++ b/sys/arch/sparc/sparc/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.18 2002/08/12 10:44:04 miod Exp $ */ +/* $OpenBSD: clock.c,v 1.19 2004/04/08 01:11:21 deraadt Exp $ */ /* $NetBSD: clock.c,v 1.52 1997/05/24 20:16:05 pk Exp $ */ /* @@ -899,6 +899,7 @@ inittodr(base) struct clockreg *cl = clockreg; int sec, min, hour, day, mon, year; int badbase = 0, waszero = base == 0; + char *bad = NULL; if (base < 5 * SECYR) { /* @@ -933,11 +934,11 @@ inittodr(base) forward: #endif if (time.tv_sec == 0) { - printf("WARNING: bad date in battery clock"); /* * Believe the time in the file system for lack of * anything better, resetting the clock. */ + bad = "WARNING: bad date in battery clock"; time.tv_sec = base; if (!badbase) resettodr(); @@ -948,10 +949,17 @@ forward: deltat = -deltat; if (waszero || deltat < 2 * SECDAY) return; + +#ifndef SMALL_KERNEL printf("WARNING: clock %s %d days", time.tv_sec < base ? "lost" : "gained", deltat / SECDAY); + bad = ""; +#endif + } + if (bad) { + printf("%s", bad); + printf(" -- CHECK AND RESET THE DATE!\n"); } - printf(" -- CHECK AND RESET THE DATE!\n"); } /* diff --git a/sys/arch/sparc64/sparc64/clock.c b/sys/arch/sparc64/sparc64/clock.c index 9ba4fe2f29b..e6af667f323 100644 --- a/sys/arch/sparc64/sparc64/clock.c +++ b/sys/arch/sparc64/sparc64/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.18 2003/05/18 15:32:10 henric Exp $ */ +/* $OpenBSD: clock.c,v 1.19 2004/04/08 01:11:22 deraadt Exp $ */ /* $NetBSD: clock.c,v 1.41 2001/07/24 19:29:25 eeh Exp $ */ /* @@ -895,6 +895,7 @@ inittodr(base) time_t base; { int badbase = 0, waszero = base == 0; + char *bad = NULL; if (base < 5 * SECYR) { /* @@ -909,13 +910,13 @@ inittodr(base) } if (todr_handle && - (todr_gettime(todr_handle, (struct timeval *)&time) != 0 || - time.tv_sec == 0)) { - printf("WARNING: bad date in battery clock"); + (todr_gettime(todr_handle, (struct timeval *)&time) != 0 || + time.tv_sec == 0)) { /* * Believe the time in the file system for lack of * anything better, resetting the clock. */ + bad = "WARNING: bad date in battery clock"; time.tv_sec = base; if (!badbase) resettodr(); @@ -928,10 +929,16 @@ inittodr(base) deltat = -deltat; if (waszero || deltat < 2 * SECDAY) return; +#ifndef SMALL_KERNEL printf("WARNING: clock %s %ld days", time.tv_sec < base ? "lost" : "gained", deltat / SECDAY); + bad = ""; +#endif + } + if (bad) { + printf("%s", bad); + printf(" -- CHECK AND RESET THE DATE!\n"); } - printf(" -- CHECK AND RESET THE DATE!\n"); } /* |