English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Linux hwclock command

Linux Command大全

The Linux hwclock command is used to display and set the hardware clock.

In Linux, there are two types of clocks: hardware clock and system clock. The hardware clock refers to the clock device on the motherboard, which is usually set in the BIOS screen. The system clock refers to the clock in the kernel. When Linux starts up, the system clock reads the settings of the hardware clock, and then the system clock 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 each time it changes the hardware clock./etc/adjtime file. Use--adjust parameter, so that hwclock can estimate the deviation of the hardware clock based on the previous records and use it to correct the current hardware clock.
  • --debug  Display detailed information when hwclock is executed.
  • --directisa  hwclock is preset from/dev/rtc device to access the hardware clock. If it is not accessible, you can use this parameter directly with I/O instruction to access the hardware clock.
  • --hctosys  Adjust the system clock to be consistent with the current hardware clock.
  • --set --date=<date and time>  Set the hardware clock.
  • --show  Display the time and date of the hardware clock.
  • --systohc  Adjust the hardware clock to be consistent with the current system clock.
  • --test  Only test the program without actually changing the hardware clock.
  • --utc  If you want to use Greenwich Mean Time, please add this parameter, hwclock will do the conversion work.
  • --version  Display version information.

Online Examples

Display Current Time

# hwclock 
2010year 05month27day Thursday 18hours 04minutes31seconds -0.704214 seconds

View Version Information

# hwclock -v
hwclock from util-linux-2.12a

Linux Command大全