diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2002-03-11 15:30:34 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2002-03-11 15:30:34 +0000 |
commit | cb83b016c34d31cf2a017c57b3bdeaa0198f25cf (patch) | |
tree | 9b4bd4084c076cfcaab622f8befa59b46c06fc79 /sys/arch/macppc | |
parent | fe1c99977003a6058b40ef10828cfecc31264348 (diff) |
If the clock has lost over 1000 days, use the filesystem time instead
of the hardware clock. Prevent clock screwage due to lost battery on laptops
where the hardware clock goes back to 0. From NetBSD.
Diffstat (limited to 'sys/arch/macppc')
-rw-r--r-- | sys/arch/macppc/macppc/clock.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/arch/macppc/macppc/clock.c b/sys/arch/macppc/macppc/clock.c index cebc44c59c1..14c3a8ea286 100644 --- a/sys/arch/macppc/macppc/clock.c +++ b/sys/arch/macppc/macppc/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.1 2001/09/01 15:44:20 drahn Exp $ */ +/* $OpenBSD: clock.c,v 1.2 2002/03/11 15:30:33 drahn Exp $ */ /* $NetBSD: clock.c,v 1.1 1996/09/30 16:34:40 ws Exp $ */ /* @@ -144,6 +144,10 @@ inittodr(base) return; printf("WARNING: clock %s %d days", time.tv_sec < base ? "lost" : "gained", deltat / SECDAY); + if (time.tv_sec < base && deltat > 1000 * SECDAY) { + printf(", using FS time"); + time.tv_sec = base; + } } printf(" -- CHECK AND RESET THE DATE!\n"); } |