In the process of using Linux, you may encounter the system and hardware clock inconsistent, that is, Date,hwclock--show see the clock is inconsistent.
The Linux clock is divided into system clocks (systems Clock) and hardware (real time Clock, short RTC) clocks. The system clock is the clock in the current Linux kernel, and the hardware clock is the battery-powered clock on the motherboard, which can be set in the BIOS. When Linux is started, the hardware clock will read the system clock settings, and the system clock will be independent of the hardware operation.
All the commands (including functions) in Linux are set by the system clock. In Linux, the commands for clock viewing and setting are mainly date, hwclock, and clock. Among them, clock and hwclock usage is similar, only use one on the line, except that the clock command supports the Alpha hardware system in addition to the x86 hardware system.
If you adjust the BIOS time, which is the hardware clock. You don't have to reboot the machine to do it in the Linux system.
# Hwclock--set--date= "4/28/05 11:10:05" (Month/day/year: minutes: SEC)
# clock--set--date= "07/07/06 10:19" (Month/day/year: minutes: SEC)
If you synchronize your system time with your hardware clock, use the
# Hwclock--hctosys (HC represents hardware time, SYS represents system time)
# clock--SYSTOHC system clock and hardware clock sync:
Settings for time zones
# Tzselect
Or
If you do not use the Tzselect command, you can modify the file change time zone.
# Vi/etc/sysconfig/clock
Zone=asia/shanghai (check the/usr/share/zoneinfo file below)
Utc=false
Arc=false
# Rm/etc/localtime
# Ln-sf/usr/share/zoneinfo/asia/shanghai/etc/localtime
Reboot can be done.
Now we look at the system time and hardware time is not the same??
# date; Hwclock
We need to know a few more orders, like Timeconfig.
There's plenty of time, and it's better to look at the configuration file in the/etc/directory.