From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,e56543fd75c8a07e,start X-Google-Attributes: gid111c93,public From: tom_holroyd@yahoo.com Subject: /sbin/clock patch Date: 1998/06/12 Message-ID: <6lqk6m$5np$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 361938001 X-Http-User-Agent: Mozilla/3.01 (X11; I; SunOS 5.4 sun4m) Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Fri Jun 12 07:09:10 1998 GMT Newsgroups: comp.os.linux.alpha I have an AlphaPC EB164LX, running 2.0.32. /sbin/clock -A *sometimes* came back with dates in the next century, but *not always*. I tracked this down to a problem in clock-alpha.c where the cmos_read(10) call would sometimes give a false positive indication of the falling edge. The following patch fixes the problem (the patch is relative to clock-1.1-2.src.rpm, available at your favorite RedHat mirror). This also works with #define USE_DEV_PORT. http://www.aist.go.jp/NIBH/~tomh/clock-alpha.patch patch included below for reference: *** clock-alpha.c.orig Fri Oct 10 00:29:15 1997 --- clock-alpha.c Fri Jun 12 15:48:44 1998 *************** *** 142,150 **** --- 142,152 ---- #define VERSION "1.4.3axp" + #define USE_DEV_PORT #undef USE_DEV_PORT #ifdef USE_DEV_PORT + # include # include #else # include *************** *** 429,435 **** if (readit || setit || adjustit) { ! int i; /* read RTC exactly on falling edge of update flag */ /* Wait for rise.... (may take upto 1 second) */ --- 431,437 ---- if (readit || setit || adjustit) { ! int i, j; /* read RTC exactly on falling edge of update flag */ /* Wait for rise.... (may take upto 1 second) */ *************** *** 438,448 **** if (cmos_read (10) & 0x80) break; ! /* Wait for fall.... (must try at least 2.228 ms) */ ! for (i = 0; i < 1000000; i++) ! if (!(cmos_read (10) & 0x80)) ! break; /* The purpose of the "do" loop is called "low-risk programming" */ /* In theory it should never run more than once */ --- 440,454 ---- if (cmos_read (10) & 0x80) break; ! /* Wait for fall.... (must try at least 2.228 ms), make sure it's really off. */ ! j = 0; ! for (i = 0; i < 1000000; i++) ! if (!(cmos_read (10>