There is a drawback when we use dual boot that is very annoying, but easy to solve. That is why in this post we will see How to fix the time difference between Windows and Linux.
Of course, displaying the time on the desktop has a purpose in itself, it frees us from having to look at our mobile phone, or if we still use it, our wristwatch. There are also other functions.
Computer Clock Functions
The internal clock of our computer, or to correctly call it the system clock or real-time clock, performs, among others, the following important tasks:
- :Time and date synchronization: Since it is not always possible to connect to a time server on the Internet, the system clock must be able to record the passage of time even when the computer is turned off. This is important to maintain an accurate log of events and to facilitate file synchronization.
- Process organization: The real-time clock assists the operating system in coordinating system processes by letting it know when they need to run and for how long.
- Security and Login: If you've ever tried to log into a banking website or online wallet with the date and time on your computer out of date, you've probably been blocked from accessing it. This is because to verify that the certificates are valid or your identity is correct, they check the date and time against the one that corresponds to your location.
- Task scheduling: The clock makes it possible to automate tasks to start at a specific date and time.
The components of a computer's internal clock are:
- Method of measurement: To keep track of the passage of time, the internal clock uses a quartz crystal capable of oscillating at a constant frequency. When oscillating, it generates the signal that updates the register. The clock is located on a chip on the motherboard that has a counter and a frequency divider. The counter is used to mark the number of oscillations and this data will be used by the frequency divider to transform it into a time signal.
- Power source: To produce the oscillations, the crystal receives energy from an independent battery, usually lithium, when the computer is off. This allows the computer to always be on time.
- Communication: When you turn on the computer, the operating system takes the data from the internal clock and uses it to synchronize the time used in the different processes.
How to fix the time difference between Windows and Linux
If you use Windows and then Linux you will see that the time is not correct (In my case, instead of showing the Argentine time, it shows the UTC time (3 hours more). If you exit Windows and enter Linux without an Internet connection, you will have a similar problem (In my case, it shows 3 hours less.
The cause of this confusion is that For Linux distributions the motherboard clock displays UTC time while Windows interprets that local time is displayed.
The easiest way to fix this is to change your Windows settings to detect the time zone automatically. This is done from the Date and Time settings panel, although it does not always work.
Another way is to make the change in Ubuntu and other systemd-based distributions (Most. This command tells the operating system to use local time for the internal clock.
sudo timedatectl set-local-rtc 1
Ignore the security warning and trust that everything will be fine. There are no known issues with using this command.
You can return to normal with the command:
sudo timedatectl set-local-rtc 0
Since I work alone on my computer, I actually set the time manually every time I log into Windows (in Ubuntu it sets itself when I connect to the web), but when more than one person uses the computer it can be annoying.