Linux system time \ Hardware time (date, tzselect, clock, Hwclock, ntpdate)

Source: Internet
Author: User
Tags time and date

1. System time and hardware time

There are two clocks of hardware clock and system clock in Linux. The hardware clock is the clock device on the motherboard, which is usually the clock that can be set on the BIOS screen. The system clock refers to the clock in the kernel. All Linux-related instructions and functions are programmed to read the system clock. Because there are two different clocks, there is a difference between them. When Linux starts, the system clock reads the settings of the hardware clock, and then the system clock runs independently.

When the system time is set with the date command, the hardware clock is not modified, so the system time is still read hardware time after the system restarts, which is why the date setting fails to the cause.

Therefore, the system time needs to be synchronized to the hardware clock after the system time has been set.

2. System time

Viewing time: Date

View time zone: Date-r

Modified: Date-s (date-s 06/22/96, date-s 13:52:00)

Modify time zone: Tzselect #按照提示进行选择时区

Write the current time and date to the BIOS to avoid failure after reboot: Hwclock-w

3. Hardware time

Clock/hwclock two commands same

Command parameters:

-R,--show read and print the hardware clock (read hardware clock and print result)
-S,--hctosys synchronizes the hardware clock to the system clock (set the time from the hardware clock)
-W,--SYSTOHC synchronizes the system clock to the hardware clock (set the hardware clock to the current system time)

4. Synchronize Network time

Ntpdate 210.72.145.44

Timed Sync Time: * * * * * */usr/sbin/ntpdate 210.72.145.44 >/dev/null 2>&1

(210.72.145.44 China XI ' An timing center official time synchronization server IP domain name)

5, with the configuration file

You can also use the configuration file time zone, but do not recommend this, do not learn it, the other can not configure the file is not clear.

Linux system time \ Hardware time (date, tzselect, clock, Hwclock, ntpdate)

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.