Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/amiga/dev Write part of the y2k fix.



details:   https://anonhg.NetBSD.org/src/rev/0120401c9194
branches:  trunk
changeset: 480098:0120401c9194
user:      is <is%NetBSD.org@localhost>
date:      Mon Jan 03 20:30:51 2000 +0000

description:
Write part of the y2k fix.
This is not strictly necessary, as
- at least for the Ricoh chip in the A3000 and A4000, as those chips' Y10
  registers happily continue to count up from 0xA if manually incremented
  past 0x9.
- the Amiga ROMs and "setclock" commands seem to interpret 0xA 0x? like
  200?, etc.

However,
- the Amiga setclock writes the modulo 10 value into the chips
- the chip docs of both chips, including the Y2K information of their
  manufacturers, only refer to the range 0-9
- the chips increment from 9 to 0

So we better conform to this, to avoid unpleasant surprises.

diffstat:

 sys/arch/amiga/dev/a2kbbc.c  |   5 ++---
 sys/arch/amiga/dev/a34kbbc.c |  11 ++++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)

diffs (68 lines):

diff -r 5e70fdbaa480 -r 0120401c9194 sys/arch/amiga/dev/a2kbbc.c
--- a/sys/arch/amiga/dev/a2kbbc.c       Mon Jan 03 18:29:03 2000 +0000
+++ b/sys/arch/amiga/dev/a2kbbc.c       Mon Jan 03 20:30:51 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: a2kbbc.c,v 1.8 2000/01/02 18:29:22 is Exp $    */
+/*     $NetBSD: a2kbbc.c,v 1.9 2000/01/03 20:30:51 is Exp $    */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -205,7 +205,6 @@
                return (0);
 
        clock_secs_to_ymdhms(secs, &dt);
-       dt.dt_year -= CLOCK_BASE_YEAR;
 
        /*
         * hold clock
@@ -237,7 +236,7 @@
        rt->day2    = dt.dt_day % 10;
        rt->month1  = dt.dt_mon / 10;
        rt->month2  = dt.dt_mon % 10;
-       rt->year1   = dt.dt_year / 10;
+       rt->year1   = (dt.dt_year / 10) % 10;
        rt->year2   = dt.dt_year % 10;
        rt->weekday = dt.dt_wday;
 
diff -r 5e70fdbaa480 -r 0120401c9194 sys/arch/amiga/dev/a34kbbc.c
--- a/sys/arch/amiga/dev/a34kbbc.c      Mon Jan 03 18:29:03 2000 +0000
+++ b/sys/arch/amiga/dev/a34kbbc.c      Mon Jan 03 20:30:51 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: a34kbbc.c,v 1.4 2000/01/02 18:29:23 is Exp $   */
+/*     $NetBSD: a34kbbc.c,v 1.5 2000/01/03 20:30:51 is Exp $   */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -127,11 +127,13 @@
        dt.dt_year  = rt->year1   * 10 + rt->year2;
 
        dt.dt_year += CLOCK_BASE_YEAR;
+       /* let it run again.. */
+       rt->control1 = A3CONTROL1_FREE_CLOCK;
+
+       printf("year read: %d.\n", dt.dt_year);
        if (dt.dt_year < STARTOFTIME)
                dt.dt_year += 100;
 
-       /* let it run again.. */
-       rt->control1 = A3CONTROL1_FREE_CLOCK;
 
        if ((dt.dt_hour > 23) ||
            (dt.dt_wday > 6) || 
@@ -165,7 +167,6 @@
                return (0);
 
        clock_secs_to_ymdhms(secs, &dt);
-       dt.dt_year -= CLOCK_BASE_YEAR;
 
        rt->control1 = A3CONTROL1_HOLD_CLOCK;
        rt->second1 = dt.dt_sec / 10;
@@ -179,7 +180,7 @@
        rt->day2    = dt.dt_day % 10;
        rt->month1  = dt.dt_mon / 10;
        rt->month2  = dt.dt_mon % 10;
-       rt->year1   = dt.dt_year / 10;
+       rt->year1   = (dt.dt_year / 10) % 10;
        rt->year2   = dt.dt_year % 10;
        rt->control1 = A3CONTROL1_FREE_CLOCK;
 



Home | Main Index | Thread Index | Old Index