Hello everyone:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <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 &lt;stdio.h&gt;<br>#include &lt;sys/io.h&gt;<br><br>unsigned char cmos_read(unsigned char addr)<br>
{<br>&nbsp;&nbsp;&nbsp; unsigned char tmp = 0;<br>&nbsp;&nbsp;&nbsp; iopl(3);<br>&nbsp;&nbsp;&nbsp; outb(addr,0x70);<br>&nbsp;&nbsp;&nbsp; tmp = inb(0x71);<br>&nbsp;&nbsp;&nbsp; iopl(0);<br>&nbsp;&nbsp;&nbsp; return tmp;<br>}<br><br><br>int main(void)<br>{<br>&nbsp;&nbsp;&nbsp; printf(&quot;seconds = %x\n&quot;,cmos_read(0));<br>
&nbsp;&nbsp;&nbsp; printf(&quot;minute = %x\n&quot;,cmos_read(2));<br>&nbsp;&nbsp;&nbsp; printf(&quot;hour = %x\n&quot;,cmos_read(4));<br>&nbsp;&nbsp;&nbsp; system(&quot;date&quot;);<br>&nbsp;&nbsp;&nbsp; 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>
&nbsp;<br><br>