Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sparc64/sparc64 Allow bigger time skips (root fs vs...



details:   https://anonhg.NetBSD.org/src/rev/1263a23d1f96
branches:  trunk
changeset: 568804:1263a23d1f96
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Aug 01 08:02:55 2004 +0000

description:
Allow bigger time skips (root fs vs. rtc), only warn if we skip more
than two days backward (same as old behaviour) or more than two years
forward. I have lots of test machines I don't power on every two days.
XXX - this should be handled more consistent across the different
ports. While here, move the default time -- in the unlikely event that
we have neither rtc nor file system time -- to this millenium.

diffstat:

 sys/arch/sparc64/sparc64/clock.c |  15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diffs (45 lines):

diff -r 0066464ab92c -r 1263a23d1f96 sys/arch/sparc64/sparc64/clock.c
--- a/sys/arch/sparc64/sparc64/clock.c  Sun Aug 01 06:36:36 2004 +0000
+++ b/sys/arch/sparc64/sparc64/clock.c  Sun Aug 01 08:02:55 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clock.c,v 1.70 2004/03/17 17:04:59 pk Exp $ */
+/*     $NetBSD: clock.c,v 1.71 2004/08/01 08:02:55 martin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.70 2004/03/17 17:04:59 pk Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.71 2004/08/01 08:02:55 martin Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -866,7 +866,7 @@
                if (base != 0)
                        printf("WARNING: preposterous time in file system\n");
                /* not going to use it anyway, if the chip is readable */
-               base = 21*SECYR + 186*SECDAY + SECDAY/2;
+               base = 33*SECYR + 186*SECDAY + SECDAY/2;
                badbase = 1;
        }
 
@@ -890,10 +890,15 @@
                cc_microset(curcpu());
                sparc_clock_time_is_ok = 1;
 
-               if (deltat < 0)
+               if (waszero)
+                       return;
+               if (deltat < 0) {
                        deltat = -deltat;
-               if (waszero || deltat < 2 * SECDAY)
+                       if (deltat < 2 * SECDAY)
+                               return;
+               } else if (deltat < 2 * SECYR) {
                        return;
+               }
                printf("WARNING: clock %s %d days",
                    time.tv_sec < base ? "lost" : "gained", deltat / SECDAY);
        }



Home | Main Index | Thread Index | Old Index