- Subject: confusion about reading time from cmos
- From: 王哲 <wangzhe5004@xxxxxxxxx>
- Date: Tue, 12 Jun 2012 15:45:01 +0800
Hello everyone:
env:
Ubuntu 11.04
I write a program reading time from cmos,and the program is as followed:
#include <stdio.h>
#include <sys/io.h>
unsigned char cmos_read(unsigned char addr)
{
unsigned char tmp = 0;
iopl(3);
outb(addr,0x70);
tmp = inb(0x71);
iopl(0);
return tmp;
}
int main(void)
{
printf("seconds = %x\n",cmos_read(0));
printf("minute = %x\n",cmos_read(2));
printf("hour = %x\n",cmos_read(4));
system("date");
return 0;
}
and run the program and the result is as followed:
wanny@wanny-C-Notebook-XXXX:~$ sudo ./a.out
seconds = 9
minute = 42
hour = 7
2012年 06月 12日 星期二 15:42:09 CST
question:
why the second is right,minute is right , but the hour is different?
Thanks in advance!!
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
[Newbies FAQ]
[Linux Kernel Development]
[IETF Annouce]
[Git]
[Networking]
[Security]
[Bugtraq]
[Photo]
[Yosemite]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux Networking]
[Linux RAID]
[Linux SCSI]
[Linux ACPI]