From c2c74080544d2b3d9b4eca7d2a0ceb07736a003c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20R=C4=99korajski?= Date: Thu, 19 Aug 1999 19:34:07 +0000 Subject: [PATCH] 21574a54e96745c44f729ea2a03639d2 clock-1.1-fix.patch Changed files: clock-fix.patch -> 1.1 --- clock-fix.patch | 87 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 clock-fix.patch diff --git a/clock-fix.patch b/clock-fix.patch new file mode 100644 index 0000000..bed7655 --- /dev/null +++ b/clock-fix.patch @@ -0,0 +1,87 @@ +--- clock-1.1/clock-alpha.c.fix Thu Oct 1 02:58:19 1998 ++++ clock-1.1/clock-alpha.c Thu Oct 1 03:03:34 1998 +@@ -153,7 +153,10 @@ + /* Here the information for time adjustments is kept. */ + #define ADJPATH "/etc/adjtime" + +- ++/* for BCD formart clock maintenance */ ++#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10) ++#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10) ++ + /* used for debugging the code. */ + #undef KEEP_OFF + +@@ -170,6 +173,7 @@ + int universal = 0; + int debug = 0; + int arcit = 0; ++int bcdit = 0; + int clockport = 0x70; + const char *pgm_name; + +@@ -299,14 +303,28 @@ + save_freq_select = cmos_read (10); /* stop and reset prescaler */ + cmos_write (10, (save_freq_select | clockport)); + ++ if (arcit) /* Alpha ARC console */ ++ tm->tm_year -= 80; ++ ++ if (!(cmos_read (11) & 0x04) || bcdit) { ++#if 0 ++ printf("writing CMOS time in BCD format!\n"); ++#endif ++ BIN_TO_BCD(tm->tm_sec); ++ BIN_TO_BCD(tm->tm_min); ++ BIN_TO_BCD(tm->tm_hour); ++ BIN_TO_BCD(tm->tm_wday); ++ BIN_TO_BCD(tm->tm_mday); ++ BIN_TO_BCD(tm->tm_mon); ++ BIN_TO_BCD(tm->tm_year); ++ } ++ + cmos_write (0, tm->tm_sec); + cmos_write (2, tm->tm_min); + cmos_write (4, tm->tm_hour); + cmos_write (6, tm->tm_wday + 3); + cmos_write (7, tm->tm_mday); + cmos_write (8, tm->tm_mon + 1); +- if (arcit) /* Alpha ARC console */ +- tm->tm_year -= 80; + cmos_write (9, tm->tm_year); + + cmos_write (10, save_freq_select); +@@ -435,7 +453,11 @@ + /* Wait for rise.... (may take upto 1 second) */ + + for (i = 0; i < 10000000; i++) +- if (cmos_read (10) & 0x80) ++#ifdef __alpha__ ++ if (cmos_read (12) & 0x10) ++#else /* __alpha__ */ ++ if (cmos_read (10) & 0x80) ++#endif /* __alpha__ */ + break; + + /* Wait for fall.... (must try at least 2.228 ms) */ +@@ -457,6 +479,20 @@ + tm.tm_year = cmos_read (9); + } + while (tm.tm_sec != cmos_read (0)); ++ ++ if (!(cmos_read (11) & 0x04) || bcdit) { ++#if 0 ++ printf("reading CMOS time in BCD format!\n"); ++#endif ++ BCD_TO_BIN(tm.tm_sec); ++ BCD_TO_BIN(tm.tm_min); ++ BCD_TO_BIN(tm.tm_hour); ++ BCD_TO_BIN(tm.tm_wday); ++ BCD_TO_BIN(tm.tm_mday); ++ BCD_TO_BIN(tm.tm_mon); ++ BCD_TO_BIN(tm.tm_year); ++ } ++ + if (arcit) { /* Alpha ARC console */ + tm.tm_year += 80; + } else { -- 2.44.0