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 typically set in the BIOS screen. The system clock is the clock in the kernel. When Linux starts, the system clock reads the settings of the hardware clock and then operates independently. All Linux-related commands and functions read the settings of the system clock.
Syntax
hwclock [--adjust][--debug][--directisa][--hctosys][--show][--systohc][--test]
[--utc][--version][--set --date=<date and time>]
Parameters:
--adjust: hwclock records changes to the hardware clock in the /etc/adjtime file. Using the --adjust parameter allows hwclock to estimate the deviation of the hardware clock based on previous records and correct the current hardware clock.
--debug: Displays detailed information during hwclock execution.
--directisa: hwclock defaults to accessing the hardware clock from the /dev/rtc device. If access is not possible, this parameter can be used to directly access the hardware clock with I/O commands.
--hctosys: Adjusts the system clock to match the current hardware clock.
--set --date=<date and time>: Sets the hardware clock.
--show: Displays the time and date of the hardware clock.
--systohc: Adjusts the hardware clock to match the current system clock.
--test: Tests the program without actually changing the hardware clock.
--utc: If you want to use Greenwich Mean Time, add this parameter, and hwclock will perform the conversion.
--version: Displays version information.
Examples
Display the current time
# hwclock
Thursday, May 27, 2010 18:04:31 -0.704214 seconds
View version information
# hwclock -v
hwclock from util-linux-2.12a