Linux system and hardware time to modify

 

    linux system clock has two, one is the hardware clock, BIOS that is time that we see a time when the CMOS settings, and a system clock, the system is linux Kernel time. When Linux boots, the system will go read the Kernel hardware clock is set, then the system clock will operate independent of the hardware. Sometimes we find that the system clock and the hardware clock is inconsistent, and therefore need to perform time synchronization, the following will share time setting and clock synchronization and usage instructions.

1, the system time to view and set

Check the system time date

Set the system date:

date command to set the date to June 10, 2019

 ----   date -s 06/10/19

Set the system time

Set the time 14:20:50

 ----   date -s 14:20:50

Set the time at 14:16:30 on June 18 2019 (MMDDhhmmYYYY.ss)

----date 0618191614.30

 

 

2, view and set the hardware time

View the system hardware clock

hwclock --show or

clock  --show

Set hardware time

 hwclock --set --date = "06/18/14 14:55" (month / day / year hours: minutes: seconds) or # clock --set --date = "06/18/14 14:55" (month / day / year hours: minutes: seconds)

 

 3, clock synchronization system and hardware.

 

Hardware clock and system clock synchronization:

# Hwclock --hctosys or # clock --hctosys hc represent hardware time, sys represents the system time, i.e., hardware clock synchronization with the system clock

System clock and the hardware clock synchronization:

# Hwclock --systohc or # clock --systohc i.e. hardware clock synchronized with the system clock

Guess you like

Origin blog.csdn.net/ths512/article/details/91385711