Hello everyone:<br> <br>env:<br>Ubuntu 11.04<br><br>I write a program reading time from cmos,and the program is as followed:<br><br>#include <stdio.h><br>#include <sys/io.h><br><br>unsigned char cmos_read(unsigned char addr)<br>
{<br> unsigned char tmp = 0;<br> iopl(3);<br> outb(addr,0x70);<br> tmp = inb(0x71);<br> iopl(0);<br> return tmp;<br>}<br><br><br>int main(void)<br>{<br> printf("seconds = %x\n",cmos_read(0));<br>
printf("minute = %x\n",cmos_read(2));<br> printf("hour = %x\n",cmos_read(4));<br> system("date");<br> return 0;<br>}<br><br><br>and run the program and the result is as followed:<br>
<br>wanny@wanny-C-Notebook-XXXX:~$ sudo ./a.out<br>seconds = 9<br>minute = 42<br>hour = 7<br>2012年 06月 12日 星期二 15:42:09 CST<br><br>question:<br>why the second is right,minute is right , but the hour is different?<br><br>Thanks in advance!!<br>
<br><br>