hwclock:tldr:484da
The command "hwclock" is a Linux command used to display or set the hardware clock (also known as the Real Time Clock or RTC) of a computer.
When the system shuts down or reboots, the current time and date are saved to the hardware clock, which is an independent clock in the computer's hardware. On the next system startup, the system reads the hardware clock and sets the system time accordingly.
Usage of the "hwclock" command:
-
Displaying the hardware clock: The basic usage of "hwclock" without any arguments or options displays the current time and date of the hardware clock.
-
Applying the system time to the hardware clock: The "--systohc" or "--hctosys" option synchronizes the system time with the hardware clock. It sets the time of the hardware clock to the system time or vice versa.
-
Setting the hardware clock: By using the "--set" option along with the desired time and date, you can manually set the hardware clock.
-
Adjusting for time drift: The "--adjust" or "-a" option adjusts the time of the hardware clock based on the estimated drift since the last update.
-
Timezone conversion: The "-r" option displays the time from the hardware clock after converting it to the currently set time zone.
It is important to note that the "hwclock" command usually requires root or superuser privileges to execute, as it deals with low-level hardware operations.