PikoPong
  • Web Dev
  • Hack
  • Database
  • Big Data
  • AWS
  • Linux
No Result
View All Result
PikoPong
  • Web Dev
  • Hack
  • Database
  • Big Data
  • AWS
  • Linux
No Result
View All Result
PikoPong
No Result
View All Result
Home Linux

[Solved] Wrong Time in Windows 10 After Dual Boot With Linux

April 1, 2021
in Linux
286 6
[Solved] Wrong Time in Windows 10 After Dual Boot With Linux


If you dual boot Windows and Ubuntu or any other Linux distribution, you might have noticed a time difference between the two operating systems.

When you use Linux, it shows the correct time. But when you boot into Windows, it shows the wrong time. Sometimes, it is the opposite and Linux shows the wrong time and Windows has the correct time.

That’s strange specially because you are connected to the internet and your date and time is set to be used automatically.

Don’t worry! You are not the only one to face this issue. You can fix it by using the following command in the Linux terminal:

timedatectl set-local-rtc 1

Again, don’t worry. I’ll explain in detail how the above command fixes the wrong time issue in Windows after dual boot. But before that, let me tell you why you encounter a time difference in a dual boot setup.

Why Windows and Linux show different time in dual boot?

A computer has two main clocks: a system clock and a hardware clock.

A hardware clock which is also called RTC (real time clock) or CMOS/BIOS clock. This clock is outside the operating system, on your computer’s motherboard. It keeps on running even after your system is powered off.

The system clock is what you see inside your operating system.

When your computer is powered on, the hardware clock is read and used to set the system clock. Afterwards, the system clock is used for tracking time. If your operating system makes any changes to system clock, like changing time zone etc, it tries to sync this information to the hardware clock.

By default, Linux assumes that the time stored in the hardware clock is in UTC, not the local time. On the other hand, Windows thinks that the time stored on the hardware clock is local time. That’s where the trouble starts.

Let me explain with examples.

You see I am in Kolkata time zone which is UTC+5:30. After installing, when I set the timezone in Ubuntu to the Kolkata time zone, Ubuntu syncs this time information to the hardware clock but with an offset of 5:30 because hardware clock (RTC) has to be in UTC for Linux.

Let’ say the current time in Kolkata timezone is 15:00 which means that the UTC time is 09:30.

Now when I turn off the system and boot into Windows, the hardware clock has the UTC time (09:30 in this example). But Windows thinks the hardware clock has stored the local time. And thus it changes the system clock (which should have shown 15:00) to use the UTC time (09:30) as the local time. And hence, Windows shows 09:30 as the time which is 5:30 hours behind the actual time (15:00 in this example).

Again, if I set the correct time in Windows by toggling the automatic time zone and time buttons, you know what is going to happen? Now it will show the correct time on the system (15:00) and sync this information (notice the “Synchronize your clock” option in the image) to the hardware clock.

If you boot into Linux, it reads the time from the hardware clock which is in local time (15:00) but since Linux believes it to be the UTC time, it adds an offset of 5:30 to the system clock. Now Linux shows a time of 20:30 which is 5:30 hours ahead of the actual time.

Now that you understand the root cause of the time difference issues in dual boot, it’s time to see how to fix the issue.

Fixing Windows Showing Wrong Time in a Dual Boot Setup With Linux

There are two ways you can go about handling this issue:

Make Windows use UTC time for the hardware clockMake Linux use local time for the hardware clock

It is easier to make the changes in Linux and hence I’ll recommend going with the second method.

Ubuntu and most other Linux distributions use systemd these days and hence you can use timedatectl command to change the settings.

What you are doing is to tell your Linux system to use the local time for the hardware clock (RTC). You do that with the set-local-rtc (set local time for RTC) option:

timedatectl set-local-rtc 1

As you can notice in the image below, the RTC now uses the local time.

Now if you boot into Windows, it takes the hardware clock to be as local time which is actually correct this time. When you boot into Linux, your Linux system knows that the hardware clock is using local time, not UTC. And hence, it doesn’t try to add the off-set this time.

This fixes the time difference issue between Linux and Windows in dual boot.

You see a warning about not using local time for RTC. For desktop setups, it should not cause any issues. At least, I cannot think of one.

I hope I made things clear for you. If you still have questions, please leave a comment below.

Like what you read? Please share it with others.



Source link

Share219Tweet137Share55Pin49

Related Posts

How to Delete Partitions in Linux [Using fdisk and GParted]
Linux

How to Delete Partitions in Linux [Using fdisk and GParted]

Managing partitions is serious business, especially when you have to remove them. I find myself doing this frequently, especially...

April 20, 2021
Blanket: Ambient Noise App With Variety of Sounds to Stay Focused
Linux

Blanket: Ambient Noise App With Variety of Sounds to Stay Focused

Brief: An open-source ambient noise player offering a variety of sounds to help you focus or fall asleep.With the...

April 19, 2021
How to Deploy Seafile Server with Docker
Linux

How to Deploy Seafile Server with Docker

First off, what is Seafile? Seafile is a self-hosted file synchronization program that works with the server-client model, as...

April 18, 2021
Systemd-Free Arch With Linux-libre Kernel
Linux

Systemd-Free Arch With Linux-libre Kernel

In the last month of 2019, the Hyperbola project took a major decision of ditching Linux in favor of...

April 17, 2021
Next Post
Fixing a slow site iteratively

Fixing a slow site iteratively

Red Hat Launches RHEL Stream to Compete With the Rising Popularity of CentOS Stream

Red Hat Launches RHEL Stream to Compete With the Rising Popularity of CentOS Stream

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recommended

Getting started with Amazon DocumentDB (with MongoDB compatibility); Part 3 – using Robo 3T : idk.dev

Getting started with Amazon DocumentDB (with MongoDB compatibility); Part 3 – using Robo 3T : idk.dev

June 15, 2020
Recognizing Constraints | CSS-Tricks

Recognizing Constraints | CSS-Tricks

December 22, 2020
Web Performance Calendar » A font-display setting for slow connections

Web Performance Calendar » A font-display setting for slow connections

December 31, 2020
A Smashing Guide To The World Of Search Engine Optimization — Smashing Magazine

What Saul Bass Can Teach Us About Web Design — Smashing Magazine

February 12, 2021

Categories

  • AWS
  • Big Data
  • Database
  • DevOps
  • IoT
  • Linux
  • Web Dev
No Result
View All Result
  • Web Dev
  • Hack
  • Database
  • Big Data
  • AWS
  • Linux

Welcome Back!

Login to your account below

Forgotten Password?

Create New Account!

Fill the forms bellow to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In