hwclock
Manage the hardware clock
TLDR
Display the current time as reported by the hardware clock
Write the current software clock time to the hardware clock (sometimes used during system setup)
Write the current hardware clock time to the software clock
SYNOPSIS
hwclock [FUNCTION] [OPTION...] where FUNCTION is --adjust, --get, --hctosys, --set, --systohc
PARAMETERS
--adjust
Adjust hardware clock incrementally from drift file
--badyear
Handle 2-digit years (19xx assumed before 2000)
--clock=
Select clock: rtc (default), adjtimex, pmtimer
--date=
Set hardware clock to specified date (with --set)
--debug
Enable debugging output
--directisa
Access RTC directly via ISA bus
--get
Read and display hardware clock time
--hctosys
Set system time from hardware clock
--help
Display usage summary
--localtime
Assume hardware clock is in local time (not UTC)
--noipv6
Disable IPv6 support (for predictable)
--predict
Predict hardware clock using delay and rate
--sethwclock
Legacy: set system time from hardware clock
--set
Set hardware clock from current system time or --date
--setdate=
Set hardware clock date only (YYYY-MM-DD)
--show
Synonym for --get
--systohc
Set hardware clock from system time
--systz
Update system timezone from /etc/localtime
--test
Test mode: no changes made
--utc
Assume hardware clock is in UTC (default)
--verbose
Increase output verbosity
--version
Display version information
DESCRIPTION
hwclock is a utility to read or set the hardware clock, also known as the Real Time Clock (RTC), on IBM PC compatible systems. The RTC maintains time even when the system is powered off, powered by a small battery.
It enables synchronization between the RTC and the Linux system time (maintained by the kernel). Common workflows include:
• Setting system time from RTC on boot (--hctosys).
• Setting RTC from system time on shutdown (--systohc).
• Directly reading (--get) or setting (--set) the RTC.
By default, hwclock assumes the RTC stores time in UTC unless --localtime is specified. It supports adjustments for drift (--adjust) and direct hardware access (--directisa). Most operations require root privileges. On modern systems, timedatectl or systemd may handle this automatically.
CAVEATS
Requires root for write operations. May not work on VMs without RTC emulation. Use --directisa only if CMOS access fails. Drift file (/etc/adjtime) must be writable. Inconsistent behavior on big-endian or non-x86 systems.
DRIFT FILE
/etc/adjtime stores RTC drift rate for --adjust. Format: drift_in_seconds_per_day UTC/localtime 0.
LEGACY FUNCTIONS
-r for --get, -s for --hctosys, -w for --systohc are deprecated aliases.
HISTORY
Originally written by David Mosberger in 1993 as part of util-linux. Maintained in the util-linux project since 1995 by Karel Zak and others. Evolved to support new hardware interfaces and systemd integration.
SEE ALSO
date(1), timedatectl(1), rtc(4), rtcwake(8)


