Module Name: src Committed By: simonb Date: Sat Apr 3 12:06:53 UTC 2021
Modified Files: src/sys/kern: kern_todr.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/kern/kern_todr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/kern_todr.c diff -u src/sys/kern/kern_todr.c:1.46 src/sys/kern/kern_todr.c:1.47 --- src/sys/kern/kern_todr.c:1.46 Fri Jan 3 01:24:48 2020 +++ src/sys/kern/kern_todr.c Sat Apr 3 12:06:53 2021 @@ -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 kmutex_t todr_mutex; 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 @@ todr_set_systime(time_t base) 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");