NetBSD Problem Report #1413

From gnats  Sun Aug 27 15:41:08 1995
Received: from hubbub.cisco.com (hubbub.cisco.com [198.92.30.32]) by sun-lamp.pc.cs.cmu.edu (8.6.11/8.6.10) with ESMTP id PAA21332 for <gnats-bugs@gnats.netbsd.org>; Sun, 27 Aug 1995 15:41:06 -0400
Message-Id: <199508271940.MAA00365@spy.cisco.com>
Date: Sun, 27 Aug 1995 12:40:26 -0700
From: carrel@cisco.com
Reply-To: carrel@cisco.com
To: gnats-bugs@gnats.netbsd.org
Subject: inittodr() now requires the disk time
X-Send-Pr-Version: 3.2

>Number:         1413
>Category:       port-i386
>Synopsis:       inittodr() now requires the disk time
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    jdolecek
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Aug 27 15:50:01 +0000 1995
>Closed-Date:    Sat Nov 03 11:17:10 +0000 2001
>Last-Modified:  Sat Nov 03 11:17:10 +0000 2001
>Originator:     David Carrel
>Release:        19950818
>Organization:
	Just me!
>Environment:
	i386 port, intel 486 in a gateway 2000 laptop.  Kernel contains
personal modifications for APM development.

System: NetBSD spy 1.0A NetBSD 1.0A (DAVE) #15: Fri Aug 18 09:19:25 PDT 1995 carrel@spy:/home/haydon/NetBSD/src/sys/arch/i386/compile/DAVE i386


>Description:
	The routine inittodr() in sys/arch/i386/isa/clock.c used to not use
the parameter that was passed in.  It is now used to provide the time-stamp
from the disk and warnings are printed/logged if the value differs
significantly from the real time clock value.  But this routine should
allow itself to be called without having to pass in the filesystem
timestamp.  If the value passed in is zero, it should not be assumed to be
a valid time and the comparisons should not be done.
	This should probably be fixed in other ports, but I'm not doing
work with that routine in any other ports so I haven't looked into it.
>How-To-Repeat:
	Call inittodr() with a value of zero.  See sys/mfs/mfs_vfsops.c
I am using this in my APM code and I don't believe that this should be
concerned with the file-system time.  I just want the real-time clock time.
>Fix:
	The following patch fixes this:

*** clock.c.orig	Wed Aug 16 08:55:59 1995
--- clock.c	Fri Aug 25 09:15:16 1995
***************
*** 400,406 ****
  	 * the latter case, it's likely that the CMOS battery has died.)
  	 */

! 	if (base < 15*SECYR) {	/* if before 1985, something's odd... */
  		printf("WARNING: preposterous time in file system\n");
  		/* read the system clock anyway */
  		base = 17*SECYR + 186*SECDAY + SECDAY/2;
--- 400,406 ----
  	 * the latter case, it's likely that the CMOS battery has died.)
  	 */

! 	if (base && base < 15*SECYR) { /* if before 1985, something's odd... */
  		printf("WARNING: preposterous time in file system\n");
  		/* read the system clock anyway */
  		base = 17*SECYR + 186*SECDAY + SECDAY/2;
***************
*** 438,449 ****
  	if (tz.tz_dsttime)
  		n -= 3600;

! 	if (base < n - 5*SECYR)
! 		printf("WARNING: file system time much less than clock time\n");
! 	else if (base > n + 5*SECYR) {
! 		printf("WARNING: clock time much less than file system time\n");
! 		printf("WARNING: using file system time\n");
! 		goto fstime;
  	}

  	timeset = 1;
--- 438,453 ----
  	if (tz.tz_dsttime)
  		n -= 3600;

! 	if (base) {
! 		if (base < n - 5*SECYR)
! 			printf("WARNING: file system time much less than "
! 			       "clock time\n");
! 		else if (base > n + 5*SECYR) {
! 			printf("WARNING: clock time much less than file "
! 			       "system time\n");
! 			printf("WARNING: using file system time\n");
! 			goto fstime;
! 		}
  	}

  	timeset = 1;

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: gnats-admin->port-i386-maintainer 
Responsible-Changed-By: fair 
Responsible-Changed-When: Mon Dec 28 09:48:44 PST 1998 
Responsible-Changed-Why:  
This PR is the responsibility of the portmaster, 
not the GNATS database administrator. 
Responsible-Changed-From-To: port-i386-maintainer->jdolecek 
Responsible-Changed-By: jdolecek 
Responsible-Changed-When: Wed Jul 4 02:28:15 PDT 2001 
Responsible-Changed-Why:  
I'll look at this 
State-Changed-From-To: open->closed 
State-Changed-By: jdolecek 
State-Changed-When: Sat Nov 3 03:16:35 PST 2001 
State-Changed-Why:  
Fixed in rev.1.68 of sys/arch/i386/isa/clock.c, thanks for report. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.