2007年11月4日星期日

上周rtc的hwclock问题

开机后mmi每次读取rtc时间后都要把+8小时再设置到rtc寄存器中,这8小时就是utc与localtime之前的差,后来huangyh换了一个北京busybox里的hwclock算是解决了。今天看到busybox的buglist id0000074说到1.0.0版本hwclock的问题,网址是:
http://bugs.uclibc.org/view.php?id=74

Given a system with RTC that has the time programmed in UTC, and /etc/TZ contains EST5EDT... then the following work as expected

# date
Tue Feb 1 14:23:29 EST 2005
# date -u
Tue Feb 1 19:23:30 UTC 2005

The hwclock utility seems to mix up the two cases:
# hwclock
Tue Feb 1 19:22:17 2005 0.000000 seconds
# hwclock -u
Tue Feb 1 14:22:29 2005 0.000000 seconds
# hwclock -l
Tue Feb 1 19:22:44 2005 0.000000 seconds

Normally "hwclock" with no argument prints local time, and with "-u" should print UTC. The "-l" option fails to print local time. Also "-l" does not exist in the regular hwclock program.

然后我用自己下载的busybox1.0.0与1.7.2做了一下对比,发现这2个版本的hwclock现象相同,但是跟buglist里描述的现象又不一样。现象是

[root@localhost busybox-1.00]# date
2007年 11月 04日 星期日 23:49:21 HKT
[root@localhost busybox-1.00]# date -u
2007年 11月 04日 星期日 15:49:27 UTC

[root@localhost busybox-1.00]# ./busybox hwclock
Sun Nov 4 23:49:17 2007 0.000000 seconds
[root@localhost busybox-1.00]# ./busybox hwclock -u
Mon Nov 5 07:49:20 2007 0.000000 seconds
[root@localhost busybox-1.00]# ./busybox hwclock -l
Sun Nov 4 23:49:23 2007 0.000000 seconds

[root@localhost busybox-1.7.2]# ./busybox hwclock
Sun Nov 4 23:49:57 2007 0.000000 seconds

[root@localhost busybox-1.7.2]# ./busybox hwclock -u
Mon Nov 5 07:49:52 2007 0.000000 seconds
[root@localhost busybox-1.7.2]# ./busybox hwclock -l
Sun Nov 4 23:50:00 2007 0.000000 seconds

没有评论: