The time is lost in Ubuntu and Windows. How Ubuntu and Windows did not divide time Windows ubuntu time is lost

In this article, I talked about the reasons and their solutions if the date and time on your computer is lost. This article dealt with common problems regardless of the number of operating systems installed on your laptop and system unit.

Today we’ll talk about the problem when the time, namely the clock, goes wrong by several hours, as if the time zone is changing. This problem arose for me after I started using two Linux and Windows operating systems on my PC at the same time.

This problem turns out to be not so new. To solve this problem, many problems have been written on the Internet.

The essence of the problem is if the time is wrong.

There are two operating systems on the PC, namely Linux and Windows.

I'm running Linux - the time is normal.

I did some work and rebooted into windows - the time shows several hours earlier (or later, I don’t remember exactly).

I set the time, set up automatic synchronization with the Internet, but nothing helped. The problem cannot be solved in a simple way. I searched the Internet and it turns out that the problem is that the computer has two types of clocks, hardware and software.

The hardware clock always runs, even when the computer is turned off, there is an additional battery, an accumulator on the board. It maintains the passage of time and saves settings.

Program time, it is recorded in the program when turned on and then taken from there.

Windows and Linux work differently with these clocks, hence the timing glitch when rebooting from one operating system to another.

Here. What is written about this on other sites about this:

How to solve this problem?

Make windows and linux work the same with this hardware clock.

On the Internet, on the topic “time is lost,” it is written that the right solution would be to make Windows work correctly. Linux works correctly, according to many people.

This means that Windows needs to be made to work like Linux over time.

The process of solving the problem itself.

You need to add the key to the registry of your Windows operating system.

There are ways to add this key using a command, using the command line. We will do everything by hand in order. And it will be clear to ourselves what we did, and our brains will work a little.

Call the Execute window using a keyboard shortcut +R. Or just select execute from the menu.

Type regedit and click OK.

The Registry Editor will open.

Go to the registry branch along the path HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation

There, in the left half of the editor, right-click and click create parameter

For x32 bit DWORD systems

For x64 bit QWORD systems

Give it the name RealTimeIsUniversal

Using multiple operating systems on the same computer sometimes causes them to conflict with each other when they use the same thing. Sometimes it concerns something as simple as time. Even such popular PC operating systems as Windows and Ubuntu can not get along and constantly change each other's time to the incorrect one.

The reasons for this phenomenon are actually simple: Windows perceives the system time (which is displayed in the CMOS settings) as local (taking into account the time zone), and Ubuntu - according to UTC (Greenwich Mean Time, not taking into account the time zone). Because of this, they adjust the system time to suit their logic, violating each other's logic.

The solution to the problem is also simple: either force Windows to add a time zone offset to the system time, or prevent Ubuntu from adding this offset.

Settings in Ubuntu

Starting from version 16.04, time display settings can be switched using two commands.

Enabling local time display:
sudo hwclock --localtime --adjust

Enabling UTC display:
sudo hwclock --utc --adjust

In older versions of Ubuntu you need to edit the rtC file:

sudo nano /etc/default/rcS

You need to add (to display local time) or remove this line (to display UTC time):

Settings in Windows

In Windows, almost all system settings are edited in the registry; TimeZoneInformation, which is necessary in this situation, is no exception. It is located in the registry at this address:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation

Here you need to add or change the RealTimeIsUniversal parameter. Its type is DWORD. In order for the system time to be read in UTC, you need to set the value to 1; to recognize it as local, you need to set the value to 0 or completely remove this parameter.

The Registry Editor can be launched using the regedit command.

In UEFI mode (Secure Boot). My BIOS time is correct.

When I boot into Ubuntu and then boot into Windows 10, it shows the wrong time. I have to fix it manually or online in Windows 10 and when I reboot into Windows 10 it is not a problem. The clock shows the correct time. And then when I reboot into Linux the clock is correct, but when going back to Windows 10 the clock starts working again.

Operating systems store and retrieve time in a hardware clock located on your motherboard to keep track of time even when the system is not powered. Most operating systems (Linux/Unix/Mac) store the time on the hardware clock as UTC by default, although some systems (notably Microsoft Windows) store the time on the hardware clock as "local" time. This causes problems on a dual boot system if both systems treat the hardware clock differently.

The advantage of using a hardware clock as UTC is that you don't have to change the hardware clock when moving between time zones or when Daylight Saving Time (DST) starts or ends, since UTC has no time or time offsets.

Changing Linux to use local time is easier and more reliable than changing Windows to use UTC, so dual boot Linux/Windows systems typically use local time.

Since Intrepid (8.10), UTC = yes is the default.

Make Windows use UTC

Note. This method was originally not supported in Windows Vista and Server 2008, but returned with Vista SP2, Windows 7, Server 2008 R2, and Windows 8/8.1.

So that MS Windows calculates the time from the hardware clock in UTC format.

Create a file named WindowsTimeFixUTC.reg with the following content, and then double-click it to merge the content into the registry:

Windows Registry Editor Version 5.00 "RealTimeIsUniversal"=dword:00000001

Note. The Windows Time service will still record local time in the RTC regardless of the registry setting above when turned off, so it is convenient to disable the Windows Time service using this command (if time synchronization is required while Windows is using some third party time synchronization):

Sc config w32time start= disabled

Cancel change

You can create a file with the following content and then double-click it to merge the original changes as above:

Windows Registry Editor Version 5.00 "RealTimeIsUniversal"=-

If the Windows Time service was disabled, enable it again using the command:

Sc config w32time start= demand

Make Linux "local" time

To tell your Ubuntu system that the hardware clock is set to "local" time:

  1. change /etc/default/rcS
  2. add or change the following section

    # Set UTC=yes if your hardware clock is set to UTC (GMT) UTC=no

Ubuntu 15.04 and higher systems (eg Ubuntu 16.04 LTS):

    open a terminal and run the following command

    Many new users who have just switched to Linux from the Windows operating system, and still run this system from time to time, are faced with the problem that after loading Windows in Ubuntu, the time goes back or forth several hours, then after several reboots it’s already difficult understand what time it is now. All this happens due to differences in the time storage format in these operating systems. And it will happen every time you reboot, no matter how much you set the correct time. But this problem can be solved. And even in several ways. In this article we will look at how to solve the problem of time getting lost in Ubuntu and Windows.

    CONFIGURING WINDOWS TO WORK WITH UTC

    So, if you experience windows and linux timing problems when switching between operating systems, the best way is to force Windows to work in a more correct and logical format. To do this, just add one registry key. You can do this with one command in the console. To open the console in Windows 10, move your mouse to the lower left corner, then click the right button. From the context menu, select Command Line (Administrator):

    > Reg add HKLM\SYSTEM\CurrentControlSet\Control\Ti meZoneInformation /v RealTimeIsUniversal /t REG_DWORD /d 1

    And for 64-bit, you need to use the REG_QWORD value type:

    > Reg add HKLM\SYSTEM\CurrentControlSet\Control\Ti meZoneInformation /v RealTimeIsUniversal /t REG_QWORD /d 1

    Target="_blank">https://losst.ru/wp-content/uploads/2016/10/utc-windows-600x139-300x70.png 300w" width="600" />

    Almost ready, but the Windows time service, regardless of this setting, will write the time in local format when updating it via the Internet, so it is convenient to disable this service. To do this, run:

    > sc config w32time start= disabled

    HOW TO RETURN BACK?

    If you want to return everything to the way it was, then this can be done as easily as possible. First we return the registry key to the correct position:

    > Reg add HKLM\SYSTEM\CurrentControlSet\Control\Ti meZoneInformation /v RealTimeIsUniversal /t REG_DWORD /d 0

    And start the synchronization service back:

    > sc config w32time start= demand

    CONFIGURING LINUX FOR LOCALTIME

    By default, Linux uses the UTC time format, but if Ubuntu 16.04 messes with Windows time, you can very easily force the system to store local time in the hardware timer. On all distributions that use Systemd, including Ubuntu 16.04, all you need to do is run the command:

    Sudo timedatectl set-local-rtc 1 --adjust-system-clock

    To view the current state of the hardware and software clocks, run:

    Sudo timedatectl

    Target="_blank">https://losst.ru/wp-content/uploads/2016/10/rtc-localtime-600x242-300x121.jpg 300w" width="600" />

    Done, you can now restart your computer and start Windows to make sure that the time does not get lost when rebooting. On older Ubuntu systems, you need to edit the /etc/default/rcS file and replace UTC=yes with UTC=no. You can do this with the command:

    Sudo sed -i "s/UTC=yes/UTC=no/" /etc/default/rcS

    HOW TO RETURN BACK?

    Again, you can return everything as it was with one command:

    Sudo timedatectl set-local-rtc 0

    And in older Ubuntu distributions:

    Sudo sed -i "s/UTC=no/UTC=yes/" /etc/default/rcS

    CONCLUSIONS

    That's all. Now, if you encounter a problem in Windows 10 - the time is lost on Ubuntu or any other Linux distribution, you will already know how to solve it using two completely working methods.

    If you want to see on our website answers to your questions about everything related to Apple technology, the Mac OS X operating system (and its launch on a PC), write to us via or.

    We received the following question:

    good afternoon!
    Hackintosh runs Snow Leopard, Windows 7 and Ubuntu. The time constantly gets lost after a reboot ((Mac OS always sets it back 4-5 hours! Tell me how to fix the problem

    A problem with time synchronization is relevant not only for Hackintoshes, but also for real Macs, on which Windows runs via Boot Camp. The reason for this is very simple: Mac OS X always assumes that the time recorded in the BIOS (or EFI) is written there in the format UTC- in other words, according to Greenwich. To it she adds the appropriate correction for the time zone.

    But Windows does things differently: it reads directly time from BIOS. And if you change this time, or it is automatically synchronized, then it will be recorded in the BIOS in the corrected format: UTC+correction.

    How to resolve this contradiction? There are two approaches: one from the Mac OS side, the other from the Windows and Linux side.

    Solution using Mac OS X

    Let's say right away that this is not the best way. The bottom line is that for Mac OS X we set the time zone to Greenwich Mean Time. For example, in the settings (remote date and time, tab Timezone) select as your locality Reykjavik.

    In addition, on the tab "Date and time" Be sure to disable automatic time synchronization, otherwise it will turn out even worse than before.

    After these steps, the time in Windows will always be correct, and Mac OS X will not mess it up. But why isn't this the best way? The fact is that if you synchronize some gadget with Mac OS X - for example, an iPhone, then the wrong time zone will distort many important data. For example, the time of incoming SMS will also be Greenwich.

    Solution using Windows and Linux

    Another way is to have Windows and Linux read the time from the BIOS the same way Mac OS does. Fortunately, such an opportunity is indeed provided, but it is hidden very deeply.

    On Windows, you will have to run the program from the Run window regeditRegistry editor. Then go to the thread \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation and create a DWORD value there with the name RealTimeIsUniversal and a value equal to one:

    On Linux (at least on Ubuntu), you need to edit the file /etc/default/rcS in any text editor and replace the contents of the parameter "UTC=no" on "UTC=yes".

    After this, reboot into Mac OS X and set your native time zone, at the same time you can enable automatic time synchronization via the Internet. After rebooting in Windows and Ubuntu you will see exactly the same time.