]> git.pld-linux.org Git - packages/clock.git/blob - clock-fix.patch
- adapterized and made spec %%debug ready or added using %%rpm*flags macros
[packages/clock.git] / clock-fix.patch
1 --- clock-1.1/clock-alpha.c.fix Thu Oct  1 02:58:19 1998
2 +++ clock-1.1/clock-alpha.c     Thu Oct  1 03:03:34 1998
3 @@ -153,7 +153,10 @@
4  /* Here the information for time adjustments is kept. */
5  #define ADJPATH "/etc/adjtime"
6  
7 -
8 +/* for BCD formart clock maintenance */
9 +#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
10 +#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
11 +    
12  /* used for debugging the code. */
13  #undef KEEP_OFF
14  
15 @@ -170,6 +173,7 @@
16  int universal = 0;
17  int debug = 0;
18  int arcit = 0;
19 +int bcdit = 0;
20  int clockport = 0x70;
21  const char *pgm_name;
22  
23 @@ -299,14 +303,28 @@
24    save_freq_select = cmos_read (10);       /* stop and reset prescaler */
25    cmos_write (10, (save_freq_select | clockport));
26  
27 +  if (arcit) /* Alpha ARC console */
28 +      tm->tm_year -= 80;
29 +  
30 +  if (!(cmos_read (11) & 0x04) || bcdit) {
31 +#if 0
32 +      printf("writing CMOS time in BCD format!\n");
33 +#endif
34 +      BIN_TO_BCD(tm->tm_sec);
35 +      BIN_TO_BCD(tm->tm_min);
36 +      BIN_TO_BCD(tm->tm_hour);
37 +      BIN_TO_BCD(tm->tm_wday);
38 +      BIN_TO_BCD(tm->tm_mday);
39 +      BIN_TO_BCD(tm->tm_mon);
40 +      BIN_TO_BCD(tm->tm_year);
41 +  }
42 +  
43    cmos_write (0, tm->tm_sec);
44    cmos_write (2, tm->tm_min);
45    cmos_write (4, tm->tm_hour);
46    cmos_write (6, tm->tm_wday + 3);
47    cmos_write (7, tm->tm_mday);
48    cmos_write (8, tm->tm_mon + 1);
49 -  if (arcit) /* Alpha ARC console */
50 -    tm->tm_year -= 80;
51    cmos_write (9, tm->tm_year);
52  
53    cmos_write (10, save_freq_select);
54 @@ -435,7 +453,11 @@
55  /* Wait for rise.... (may take upto 1 second) */
56  
57        for (i = 0; i < 10000000; i++)   
58 -       if (cmos_read (10) & 0x80)
59 +#ifdef __alpha__
60 +         if (cmos_read (12) & 0x10)
61 +#else /* __alpha__ */
62 +             if (cmos_read (10) & 0x80)
63 +#endif /* __alpha__ */
64           break;
65  
66  /* Wait for fall.... (must try at least 2.228 ms) */
67 @@ -457,6 +479,20 @@
68           tm.tm_year = cmos_read (9);
69         }
70        while (tm.tm_sec != cmos_read (0));
71 +
72 +      if (!(cmos_read (11) & 0x04) || bcdit) {
73 +#if 0
74 +         printf("reading CMOS time in BCD format!\n");
75 +#endif
76 +         BCD_TO_BIN(tm.tm_sec);
77 +         BCD_TO_BIN(tm.tm_min);
78 +         BCD_TO_BIN(tm.tm_hour);
79 +         BCD_TO_BIN(tm.tm_wday);
80 +         BCD_TO_BIN(tm.tm_mday);
81 +         BCD_TO_BIN(tm.tm_mon);
82 +         BCD_TO_BIN(tm.tm_year);
83 +      }
84 +      
85        if (arcit) { /* Alpha ARC console */
86         tm.tm_year += 80;
87        } else {
This page took 0.336926 seconds and 3 git commands to generate.