硬件时钟和时区的问题

来源:互联网 发布:37热血战歌羽化数据 编辑:程序博客网 时间:2024/05/29 10:47

前不久开发板需要显示时钟,但是默认的是UTC时间,所以增加时区文件。

//复制上海时区/usr/share/zoneinfo/Asia/Shanghai文件为localtime到/etc下cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

但是调试时钟时发现,设置时间并写入硬件后,开机总是快8小时。

调查发现写入硬件使用的是hwclock -w,默认写出的是本地时间,而开机时内核是按照UTC写入时间的,刚好增加8小时。

所以讲hwclock -w 换成hwclock -uw即可正常工作了。

hwclock: invalid option -- yBusyBox v1.15.2 (2009-10-26 18:24:41 CST) multi-call binaryUsage: hwclock [-r|--show] [-s|--hctosys] [-w|--systohc] [-l|--localtime] [-u|--utc] [-f FILE]Query and set hardware clock (RTC)Options:        -r      Show hardware clock time        -s      Set system time from hardware clock        -w      Set hardware clock to system time        -u      Hardware clock is in UTC        -l      Hardware clock is in local time        -f FILE Use specified device (e.g. /dev/rtc2)


//~End~

原创粉丝点击