Blog

Welcome to the CSlant Blog. Here you will find interesting articles, news, and tutorials on various topics. Stay tuned for more updates.

How to Fix the Wrong Time Display When Running Windows and Linux Ubuntu in Parallel

avatar
By System Admin

December 07, 2024

image-content

When you install and run two operating systems, such as Windows and Linux (e.g., Ubuntu), in parallel on the same computer, you may encounter a problem where the system time between the two operating systems doesn't match. This issue occurs due to differences in how each operating system handles the hardware clock (RTC - Real-Time Clock).

The Root Cause

  • Windows: By default, Windows sets the hardware clock to local time.
  • Linux: Linux, on the other hand, assumes the hardware clock is in UTC (Coordinated Universal Time) and adjusts for the local time zone.

This discrepancy results in the time being incorrect on one of the operating systems when you switch between them.


Solution: Synchronizing the System Time Between Windows and Linux

Option 1: Configure Linux to Use Local Time

This is the easiest solution and doesn't affect Windows.

  1. Open the terminal in Linux.
  2. Execute the following command to set Linux to use local time instead of UTC:

    timedatectl set-local-rtc 1 --adjust-system-clock
  3. Confirm the change with:

    timedatectl

    You should see a message like RTC in local TZ: yes.

Note: Using this method may cause issues with scheduled tasks in Linux, as most Linux systems are optimized for UTC.


Option 2: Configure Windows to Use UTC

This option adjusts Windows to use UTC instead of local time.

  1. Open the Windows Registry Editor:
    • Press Win + R, type regedit, and press Enter.
  2. Navigate to the following key:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation
  3. Create a new DWORD (32-bit) Value:
    • Right-click on the right pane, select New > DWORD (32-bit) Value, and name it RealTimeIsUniversal.
  4. Set the value of RealTimeIsUniversal to 1.
  5. Restart your computer for the changes to take effect.

Recommendation

  • Use Option 1 if you prefer a simpler approach with minimal configuration changes.
  • Use Option 2 if you primarily work in Linux or if you need to follow best practices for managing time in distributed systems.

Both methods ensure that the system time remains consistent across operating systems when running Windows and Linux in parallel.

 

Related:

Popular Tags :