Troubleshoot problems with system clock and hardware clock in Linux

Source: Internet
Author: User
Tags time zones

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.

Related Article

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.