Linux hwclock command
The Linux hwclock command is used to display and set the hardware clock.
In Linux there are two types of clocks: the hardware clock and the system clock. The hardware clock refers to the clock device on the motherboard, which is usually the clock that can be set in the BIOS screen. The system clock refers to the clock in the kernel. When Linux starts, the system clock reads the hardware clock's settings, after which the system clock operates independently. All Linux-related commands and functions read the system clock's settings.
Syntax
hwclock [--adjust][--debug][--directisa][--hctosys][--show][--systohc][--test]
[--utc][--version][--set --date=<日期与时间>]
Parameters:
- --adjust Every time hwclock changes the hardware clock, it is recorded in the /etc/adjtime file. Using the --adjust parameter makes hwclock estimate the hardware clock's deviation based on previous records and use it to correct the current hardware clock.
- --debug Display detailed information when hwclock runs.
- --directisa By default, hwclock accesses the hardware clock from the /dev/rtc device. If it cannot be accessed, this parameter can be used to access the hardware clock directly with I/O instructions.
- --hctosys Adjust the system clock to match the current hardware clock.
- --set --date=
Set the hardware clock. - --show Display the time and date of the hardware clock.
- --systohc Adjust the hardware clock to match the current system clock.
- --test Only test the program without actually changing the hardware clock.
- --utc To use Greenwich Mean Time, add this parameter and hwclock will perform the conversion.
- --version Display version information.
Example
Display the current time
# hwclock
2010年05月27日 星期四 18时04分31秒 -0.704214 seconds
View version information
# hwclock -v
hwclock from util-linux-2.12a
Linux Command Reference