hwclock
hwclock is an administration tool for the time clocks. It can display the Hardware Clock time and set the Hardware Clock.
Command Syntax
Under Linux bash, use the following format,
hwclock [function] [option...]
Parameter
Parameter | Description |
function: | |
-h, --help | Show help text and exit. |
-r, --show | Read hardware clock and print result. |
--set | Set the RTC to the time given with –date. |
-s, --hctosys | Set the system time from the hardware clock. |
-w, --systohc | Set the hardware clock from the current system time. |
--systz | Set the system time based on the current timezone. |
--adjust | Adjust the RTC to account for systematic drift since the clock was last set or adjusted. |
--getepoch | Print out the kernel's hardware clock epoch value. |
--setepoch | Set the kernel's hardware clock epoch value to the value given with –epoch. |
--predict | Predict RTC reading at time given with –date. |
-V, --version | Display version information and exit. |
option: | |
-u, --utc | The hardware clock is kept in UTC. |
--localtime | The hardware clock is kept in local time. |
-f, --rtc <file> | Special /dev/... file to use instead of default. |
--directisa | Access the ISA bus directly instead of /dev/rtc. |
--badyear | Ignore RTC's year because the BIOS is broken. |
--date <time> | Specifies the time to set the hardware clock to. |
--epoch <year> | Specifies the year which is the beginning of the hardware clock's epoch value. |
--noadjfile | Do not access /etc/adjtime; this requires the use of either --utc or –localtime. |
--adjfile <file> | Specifies the path to the adjust file; the default is /etc/adjtime. |
--test | Do not update anything, just show what would happen. |
-D, --debug | Debugging mode. |
Example
- Show the help information of hwclock command.
admin@193:/$ hwclock -h Usage: hwclock [function] [option...] Functions: -h, --help show this help text and exit -r, --show read hardware clock and print result --set set the RTC to the time given with --date -s, --hctosys set the system time from the hardware clock -w, --systohc set the hardware clock from the current system time --systz set the system time based on the current timezone --adjust adjust the RTC to account for systematic drift since the clock was last set or adjusted --getepoch print out the kernel's hardware clock epoch value --setepoch set the kernel's hardware clock epoch value to the value given with --epoch --predict predict RTC reading at time given with --date -V, --version display version information and exit Options: -u, --utc the hardware clock is kept in UTC --localtime the hardware clock is kept in local time -f, --rtc <file> special /dev/... file to use instead of default --directisa access the ISA bus directly instead of /dev/rtc --badyear ignore RTC's year because the BIOS is broken --date <time> specifies the time to which to set the hardware clock --epoch <year> specifies the year which is the beginning of the hardware clock's epoch value --noadjfile do not access /etc/adjtime; this requires the use of either --utc or --localtime --adjfile <file> specifies the path to the adjust file; the default is /etc/adjtime --test do not update anything, just show what would happen -D, --debug debugging mode
- Display hardware clock time.
admin@193:/$ hwclock --show Thu Jan 11 21:51:15 2001 -0.719120 seconds
Copyright © 2024 Pica8 Inc. All Rights Reserved.