Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sh5/sh5 If the RTC time is > 50 days out, don't use...
details: https://anonhg.NetBSD.org/src/rev/93da695b330f
branches: trunk
changeset: 546129:93da695b330f
user: scw <scw%NetBSD.org@localhost>
date: Sun Apr 20 21:26:46 2003 +0000
description:
If the RTC time is > 50 days out, don't use it at all, on the assumption
that there is no battery backup (as is the case on the Cayman).
diffstat:
sys/arch/sh5/sh5/sh5_clock.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diffs (27 lines):
diff -r c49614eb1528 -r 93da695b330f sys/arch/sh5/sh5/sh5_clock.c
--- a/sys/arch/sh5/sh5/sh5_clock.c Sun Apr 20 21:25:59 2003 +0000
+++ b/sys/arch/sh5/sh5/sh5_clock.c Sun Apr 20 21:26:46 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sh5_clock.c,v 1.3 2002/08/26 10:10:22 scw Exp $ */
+/* $NetBSD: sh5_clock.c,v 1.4 2003/04/20 21:26:46 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@@ -271,6 +271,7 @@
if (todr_gettime(todr_handle, (struct timeval *)&time) != 0 ||
time.tv_sec == 0) {
+badrtc:
printf("WARNING: bad date in battery clock");
/*
* Believe the time in the file system for lack of
@@ -286,6 +287,9 @@
deltat = -deltat;
if (waszero || deltat < 2 * SECDAY)
return;
+ if (deltat > 50 * SECDAY)
+ goto badrtc;
+
printf("WARNING: clock %s %d days",
time.tv_sec < base ? "lost" : "gained", deltat / SECDAY);
}
Home |
Main Index |
Thread Index |
Old Index