Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/news68k/news68k Fix y2k bug in inittod().
details: https://anonhg.NetBSD.org/src/rev/d6e4700c9475
branches: trunk
changeset: 480331:d6e4700c9475
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sun Jan 09 15:56:52 2000 +0000
description:
Fix y2k bug in inittod().
I misunderstood that "bad date in battery clock" message was
caused by dead-battery NVRAM. *sigh*
diffstat:
sys/arch/news68k/news68k/clock.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diffs (34 lines):
diff -r 2aa576a48b5d -r d6e4700c9475 sys/arch/news68k/news68k/clock.c
--- a/sys/arch/news68k/news68k/clock.c Sun Jan 09 15:56:37 2000 +0000
+++ b/sys/arch/news68k/news68k/clock.c Sun Jan 09 15:56:52 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.1 1999/12/09 14:53:16 tsutsui Exp $ */
+/* $NetBSD: clock.c,v 1.2 2000/01/09 15:56:52 tsutsui Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -205,12 +205,13 @@
day = FROMBCD(day);
mon = FROMBCD(mon);
year = FROMBCD(year);
+ year = year + (year >= 70 ? 1900 : 2000);
/* simple sanity checks */
- if (year < 70 || mon < 1 || mon > 12 || day < 1 || day > 31)
+ if (mon < 1 || mon > 12 || day < 1 || day > 31)
return (0);
days = 0;
- for (yr = 70; yr < year; yr++)
+ for (yr = 1970; yr < year; yr++)
days += LEAPYEAR(yr) ? 366 : 365;
days += dayyr[mon - 1] + day - 1;
if (LEAPYEAR(yr) && mon > 2)
@@ -237,6 +238,8 @@
t2 -= LEAPYEAR(t) ? 366 : 365;
}
c->year = t;
+ if (c->year >= 100)
+ c->year -= 100;
/* t3 = month + day; separate */
t = LEAPYEAR(t);
Home |
Main Index |
Thread Index |
Old Index