首页
首页 » 系统设置 » hwclock(hardware clock)

hwclock(hardware clock)

hwclock(hardware clock)
功能说明:显示与设定硬件时钟。
语  法:hwclock [--adjust][--debug][--directisa][--hctosys][--show][--systohc][--test]
[--utc][--version][--set --date=<日期与时间>]
补充说明:在Linux中有硬件时钟与系统时钟等两种时钟。硬件时钟是指主机板上的时钟设备,也就是通常可在BIOS画面设定的时钟。系统时钟则是指kernel中的时钟。当Linux启动时,系统时钟会去读取硬件时钟的设定,之后系统时钟即独立运作。所有Linux相关指令与函数都是读取系统时钟的设定。
参  数:
  --adjust  hwclock每次更改硬件时钟时,都会记录在/etc/adjtime文件中。使用--adjust参数,可使hwclock根据先前的记录来估算硬件时钟的偏差,并用来校正目前的硬件时钟。 
  --debug  显示hwclock执行时详细的信息。 
  --directisa  hwclock预设从/dev/rtc设备来存取硬件时钟。若无法存取时,可用此参数直接以I/O指令来存取硬件时钟。 
  --hctosys  将系统时钟调整为与目前的硬件时钟一致。 
  --set --date=<日期与时间>  设定硬件时钟。 
  --show  显示硬件时钟的时间与日期。 
  --systohc  将硬件时钟调整为与目前的系统时钟一致。 
  --test  仅测试程序,而不会实际更改硬件时钟。 
  --utc  若要使用格林威治时间,请加入此参数,hwclock会执行转换的工作。 
  --version  显示版本信息。

hwclock

hwclock [option]

System administration command. Read or set the hardware clock. This command maintains change information in /etc/adjtime, which can be used to adjust the clock based on how much it drifts over time. hwclock replaces the clock command. The single-letter options are included for compatibility with the older command.

Options

You may specify only one of the following options:

-a, --adjust

Adjust the hardware clock based on information in /etc/adjtime and set the system clock to the new time.

--getepoch

Print the kernel's hardware clock epoch value, then exit.

-r, --show

Print the current time stored in the hardware clock.

-s, --hctosys

Set the system time in accordance with the hardware clock.

--setepoch, --epoch=year

Set the hardware clock's epoch to year.

--set --date=date

Set the hardware clock to the specified date, a string appropriate for use with the date command.

-v, --version

Print version and exit.

-w, --systohc

Set the hardware clock in accordance with the system time.

The following may be used with the above options.

--debug

Print information about what hwclock is doing.

--localtime

The hardware clock is stored in local time.

--noadjfile

Disable /etc/adjtime facilities.

--test

Do not actually change anything. This is good for checking syntax.

-u, --utc

The hardware clock is stored in Universal Coordinated Time.