Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Print the "preposterous TOD clock time" message onl...



details:   https://anonhg.NetBSD.org/src/rev/e39aa9cced21
branches:  trunk
changeset: 954257:e39aa9cced21
user:      simonb <simonb%NetBSD.org@localhost>
date:      Sat Apr 03 12:06:53 2021 +0000

description:
Print the "preposterous TOD clock time" message only if the RTC is
before very late 2020 (1/1/2021 minus a few leap days) instead of
late 1994.  Someone(TM) should remember to adjust this in somewhat
less than 26 years.

diffstat:

 sys/kern/kern_todr.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (37 lines):

diff -r f3820da66310 -r e39aa9cced21 sys/kern/kern_todr.c
--- a/sys/kern/kern_todr.c      Sat Apr 03 12:01:00 2021 +0000
+++ b/sys/kern/kern_todr.c      Sat Apr 03 12:06:53 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_todr.c,v 1.46 2020/01/03 01:24:48 thorpej Exp $   */
+/*     $NetBSD: kern_todr.c,v 1.47 2021/04/03 12:06:53 simonb Exp $    */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
 #include "opt_todr.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_todr.c,v 1.46 2020/01/03 01:24:48 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_todr.c,v 1.47 2021/04/03 12:06:53 simonb Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -90,6 +90,9 @@
 static todr_chip_handle_t todr_handle;
 static bool todr_initialized;
 
+/* The minimum reasonable RTC date before preposterousness */
+#define        PREPOSTEROUS_YEARS      (2021 - POSIX_BASE_YEAR)
+
 /*
  * todr_init:
  *     Initialize TOD clock data.
@@ -213,7 +216,7 @@
 
        if ((todr_handle == NULL) ||
            (todr_gettime(todr_handle, &tv) != 0) ||
-           (tv.tv_sec < (25 * SECS_PER_COMMON_YEAR))) {
+           (tv.tv_sec < (PREPOSTEROUS_YEARS * SECS_PER_COMMON_YEAR))) {
 
                if (todr_handle != NULL)
                        printf("WARNING: preposterous TOD clock time\n");



Home | Main Index | Thread Index | Old Index