Linux system time and hardware time settings, linux hardware

Source: Internet
Author: User

Linux system time and hardware time settings, linux hardware
1. Introduction

In Linux, there are two types of Clock: hardware clock and system clock. The hardware clock refers to the clock device on the motherboard, that is, the clock that can usually be set on the BIOS screen. At this time, the battery power on the motherboard is maintained. If the battery on the motherboard is exhausted, the battery will be restored to the factory settings if the power is down. The system clock is the clock in the kernel. All Linux-related commands and functions are read system clock settings. Because there are two different clock types, there will be differences between them. When Linux is started, the system clock reads the hardware clock settings, and then the system clock runs independently.
For system time, we can use the date command to view:

Unicom @ ubuntu :~ $ Date
Wed Apr 15 15:52:23 CST 2015

Run the hwclock command to view the hardware time.

Unicom @ ubuntu :~ $ Sudo hwclock-show // hardware time requires root permission
[Sudo] password for unicom:
Wed Apr 15 16:13:42 2015-0.844670 seconds

2. Time settings

The time set by the date command does not change the system's hardware time. After the system is restarted, the hardware time will still be loaded, which is also a problem that often causes the date setting time to fail.
The correct method is to set the system time, and then execute it to synchronize time to the hardware clock. Of course, you can also directly set the hardware clock.
Date sets the system clock.
 # Date -- set "04/15/15" (month/day/year hour: minute: second)
Synchronize the system time to the hardware clock:
 # sudo hwclock --systohcOr# sudo hwclock -w

Directly set the hardware time:
 # Sudo hwclock -- set -- date = "04/15/15" (month/day/year hour: minute: second)
 
Common command parameters for hardware clock

Command Parameters Description
-R,-show Read hardware clock and print result)
-S,-hctosys Synchronize the hardware clock to the system clock (set the system time from the hardware clock)
-W,-systohc Synchronize the system clock to the hardware clock (set the hardware clock to the current system time)

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.