linux hardware time system time

Built a virtual machine, found that after each reboot the system clock is always a difference of more than 10 hours with the time available
After correcting date -s, reboot and the problem occurs again. So with the suspect about the hardware clock
With hwclock looked at and found that indeed there is a difference hardware clock. Adjust the hardware clock:
hwclock --set --date
[the root @ localhost ~] # DATE -s '2009-05-01 6:06:01'
Fri. 1 On May 2009 06:06:01 CST
[the root @ localhost ~] # DATE
Fri CST On May 2009 06:06:02. 1
[root @ localhost ~] # Sync
[root @ localhost ~] # hwclock
Thu 30 Apr 2009 10:30:13 PM CST -0.697852 seconds The
[root @ localhost ~] # man hwclock
[root @ localhost ~] # hwclock --set = '05 --date / 01/2009 06:10:01 '
[the root @ localhost ~] # hwclock
Fri 01 On May 2009 06:10:09 AM CST -0.464026 seconds The
original linux time divided system clock and hardware clock.
Bois hardware clock in the time, the system time is the time of the kernel.
The system reads the hardware clock every time you start the clock, and then operate independently. Therefore only modify the system
The system clock without modifying the hardware clock, then the time will be after a system restart is not correct.
 
Function: clock display setting hardware.

Syntax: hwclock [--adjust] [- Debug] [- directisa] [- hctosys] [- Show] [- systohc] [- the Test]
[--utc] [- Version] [- -set --date =]

supplementary note: there are two hardware clock and system clocks in Linux and the like. Refers to the hardware clock on the motherboard clock device, the clock is typically in the BIOS setting screen. The system clock is the clock means kernel. When Linux boots, the system clock to read the hardware clock setting, after the system clock that is independent. All Linux commands and functions are related to the system clock setting reading.

Parameters:
  --adjust when hwclock each time you change the hardware clock, will be recorded in / etc / adjtime file. --Adjust use parameter can be estimated deviation hwclock hardware clock based on the previous recording, and for correcting the current hardware clock. 
  When hwclock --debug display detailed execution information. 
  --directisa hwclock preset from / dev / rtc device to access the hardware clock. If not accessible, this parameter can be used directly in the I / O instructions to access the hardware clock. 
  --hctosys the system clock is adjusted to be consistent with the current hardware clock. 
  --set --date = set hardware clock. 
  --show time and date display hardware clock. 
  --systohc the hardware clock is adjusted to be consistent with the current system clock. 
  --test only test program, but does not actually change the hardware clock. 
  --utc To use Greenwich Mean Time, add this parameter, hwclock will perform the work of conversion. 
  --version display version information.

 

From "ITPUB blog" link: http: //blog.itpub.net/12932950/viewspace-592420/, For reprint, please indicate the source, otherwise it will be held liable.

Reproduced in: http: //blog.itpub.net/12932950/viewspace-592420/

Guess you like

Origin www.cnblogs.com/sgh69/p/12050896.html