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)