How do I understand the output and settings of Hwclock?

Source: Internet
Author: User

Then you will say, how to check my hardware time is not UTC time??

Hwclock--localtime

#如果上面这条命令的输出和UTC (GMT) time is the same, that's right, otherwise, look at the following.



Some operating systems will be very silly hwclock and localtime (is m$ if you do not know who I mean the words), of course, our advanced multi-user operating system will not do so, In general, a POSIX machine will always adjust the internal clock of the machine to UTC (Greenwich (GMT) time), and then through the Hwclock this tool at boot, from the kernel read converted to Sysclock, usually under the x86 platform, Sysclock are more accurate than hwclock.

Fart say so much, how to set the Hwclock to UTC time?

sudo cp/usr/share/zoneinfo/utc/etc/localtime

#上面这命令, set the UTC time to local time so that the Hwclock


sudo date mmddhhmm[year][. SS]

#上面这命令中时间需要是GMT时间 (or UTC time)


sudo hwclock--SYSTOHC--UTC

#上面这命令, synchronize the Sysclock to hardware time (that is, the time in the BIOS) and specify the hardware time as the UTC time Zone


sudo cp/usr/share/zoneinfo/asia/shanghai/etc/localtime

#上面这命令, set local time to Beijing time (yes, no Beijing this zoneinfo), don't believe in yourself tzselect

Date

#上面这命令, the local time will be checked


#值得玩味的是, man manual also in about--localtime, actually only with--set--SYSTOHC--ajust switch same time. Facts prove:

Hwclock--localtime #显示的是硬件时间的本地时间hwclock The true "local time" of the--UTC #显示的是当硬件时间为utc时



Resources:
Http://www.linuxfromscratch.org/hints/downloads/files/time.txt


How do I understand the output and settings of Hwclock?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.