|
Lines 66-78
Link Here
|
| 66 |
bcd2int(int bcd) |
66 |
bcd2int(int bcd) |
| 67 |
{ |
67 |
{ |
| 68 |
int retval = 0; |
68 |
int retval = 0; |
|
|
69 |
int place = 1; |
| 69 |
|
70 |
|
| 70 |
if (bcd > 0x9999) |
71 |
if (bcd > 0x9999) |
| 71 |
return -1; |
72 |
return -1; |
| 72 |
|
73 |
|
| 73 |
while (bcd) { |
74 |
while (bcd) { |
| 74 |
retval = retval * 10 + ((bcd & 0xf000) >> 12); |
75 |
retval += (bcd & 0xf) * place; |
| 75 |
bcd = (bcd & 0xfff) << 4; |
76 |
bcd >>= 4; |
|
|
77 |
place *= 10; |
| 76 |
} |
78 |
} |
| 77 |
return retval; |
79 |
return retval; |
| 78 |
} |
80 |
} |
|
Lines 194-199
Link Here
|
| 194 |
tm.tm_mday = bcd2int(xl(args.esi)); |
198 |
tm.tm_mday = bcd2int(xl(args.esi)); |
| 195 |
tm.tm_mon = bcd2int(xh(args.esi)) - 1; |
199 |
tm.tm_mon = bcd2int(xh(args.esi)) - 1; |
| 196 |
tm.tm_year = bcd2int(args.edi) - 1900; |
200 |
tm.tm_year = bcd2int(args.edi) - 1900; |
|
|
201 |
tm.tm_isdst = -1; |
| 197 |
if (cmos_wall) |
202 |
if (cmos_wall) |
| 198 |
t = mktime(&tm); |
203 |
t = mktime(&tm); |
| 199 |
else |
204 |
else |