Adjusting System Clock and Local RTC in Linux: A Tech Support Guide
In Linux, the system clock and local RTC (Real-Time Clock) are two separate but related concepts that are crucial for accurate timekeeping. The system clock is the main clock used by the operating system and applications, while the local RTC is a hardware clock that keeps time even when the system is powered off. In this article, we will discuss how to adjust the local RTC using the set-local-rtc command, and provide a detailed context of the topic, including key concepts, subtitles, and code blocks.
Understanding the Local RTC
The local RTC is a hardware clock that is typically found on the motherboard of a computer. It keeps time even when the system is powered off, and is used to provide the initial time value when the system is booted. The local RTC is also used to keep time when the system clock is not available, such as when the system is in suspend or hibernate mode.
Adjusting the Local RTC
To adjust the local RTC in Linux, you can use the set-local-rtc command. This command is typically used to set the local RTC to the current system time. The syntax for this command is:
set-local-rtc [true|false]Where true sets the local RTC to the current system time, and false sets the local RTC to an unspecified value. For example, to set the local RTC to the current system time, you would use the following command:
sudo timedatectl set-local-rtc trueMan Page Information
The man page for the set-local-rtc command states that the command changes the 3rd line of /etc/adjtime. However, in newer versions of Linux, the 3rd line of /etc/adjtime is changed to timedatectl set-local-rtc <true/false> instead of the traditional set-local-rtc command.
Checking the Local RTC
To check the current value of the local RTC, you can use the hwclock command. This command displays the current value of the local RTC, as well as the system time and the offset between the two. For example, to display the current value of the local RTC, you would use the following command:
sudo hwclockIn this article, we have discussed how to adjust the local RTC in Linux using the set-local-rtc command, and provided a detailed context of the topic, including key concepts, subtitles, and code blocks. We have also discussed the differences between the local RTC and the system clock, and provided information on how to check the current value of the local RTC.
References
- Man page for
set-local-rtc - Man page for
hwclock - Arch Linux Wiki: Realtime clock
- Ubuntu Community Help Wiki: Hardware Clock
Note: This article is intended for informational purposes only. The information provided is accurate as of the time of writing, but may change in the future. Use at your own risk.