Linux command: Setting hardware clock--hwclock

Source: Internet
Author: User
Tags time and date

Function Description: Displays and sets the hardware clock.

Syntax: Hwclock [--adjust][--debug][--directisa][--hctosys][--show][--systohc][--test]

[--UTC] [--version] [--set--date=< date and time;]

Added: There are two clocks such as hardware clock and system clock in Linux. The hardware clock is the clock device on the motherboard, which is usually the clock that can be set on the BIOS screen. The system clock refers to the clock in the kernel. When Linux starts, the system clock reads the settings of the hardware clock, and then the system clock runs independently. All Linux-related instructions and functions are programmed to read the system clock.


--adjust Hwclock is recorded in the/etc/adjtime file each time the hardware clock is changed. The--adjust parameter allows the Hwclock to estimate the deviation of the hardware clock based on previous records and use it to correct the current hardware clock.

--DEBUG displays detailed information on Hwclock execution.

--directisa Hwclock presets To access hardware clocks from/DEV/RTC devices. If not accessible, this parameter can be used to access the hardware clock directly with the I/O instruction.

The--hctosys adjusts the system clock to match the current hardware clock.

--set--date=< Date and time > Set hardware clock.

--show Displays the time and date of the hardware clock.

The--SYSTOHC adjusts the hardware clock to coincide with the current system clock.

The--test only tests the program without actually changing the hardware clock.

--UTC to use GMT, add this parameter, and Hwclock will perform the work of the conversion.

--version Displays version information.

Before setting the system date and time, make sure that the operating system time is set appropriately.

The hardware time to be set depends on the operating system time, as follows:

[Email protected] ~]# hwclock--SYSTOHC

[Email protected] ~]# hwclock--SYSTOHC--UTC

Use Hwclock without any parameters to view the current hardware date and time.

[Email protected] ~]# hwclock

This article is from the "Dragon" blog, make sure to keep this source

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

11.11 Big Sale for Cloud

Get Unbeatable Offers with up to 90% Off,Oct.24-Nov.13 (UTC+8)

Get It Now >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.