<br><br><div class="gmail_quote">2012/6/12 Vladimir Murzin <span dir="ltr"><<a href="mailto:murzin.v@gmail.com" target="_blank">murzin.v@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi!<br>
<br>
It seems that your CMOS count time in UTC. So, If CST stands for China<br>
Standart Time then time zone offset: UTC + 8 hours ;)<br>
<br></blockquote><div> Thanks,and i understand it,Time in cmos is UTC,and the system time is your local time.there is time zone between them. and time in China is earlier 8 hours than UTC,so time in China shoud be UTC + 8.<br>
and when you install the ubuntu, ubuntu will let you choose the area where you are,and configure it.and start up the OS<br>and OS read UTC from cmos,then,calculate your local time base on the UTC.<br><br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Best wishes<br>
<span class="HOEnZb"><font color="#888888">Vladimir Murzin<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On 6/12/12, 王哲 <<a href="mailto:wangzhe5004@gmail.com">wangzhe5004@gmail.com</a>> wrote:<br>
> 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>
</div></div></blockquote></div><br>