In this article, we’ll consider why the system clock displays incorrect time and date after a shutdown, restart or resuming from hibernation of a laptop/computer/server. Time is reset each time and you have to set it manually. We’ll dwell on the most typical case: a rundown BIOS battery and more interesting ones involving Windows/Linux dual boot on one computer, and a firmware bug on HPE ProLiant G9 /G8 servers with Windows Server OS.
- System Not Saving Data/Time Due to Weak BIOS/CMOS Battery
- Windows: Set Clock Synchronization with time.windows.com
- Troubleshooting time synchronization for AD domain-joined computers
- Windows & Linux Showing Different Times When Dual Booting
- HPE Servers with Windows Server: Offset in the System Time After Restart
System Not Saving Data/Time Due to Weak BIOS/CMOS Battery
The typical answer to the question “Why are the time and date reset on my computer after reboot?” is the BIOS (CMOS) battery rundown. This battery is responsible for keeping BIOS/UEFI settings when your computer or laptop is unplugged, and provides autonomous operations of the built-in hardware clock.
If the battery has run down, when the motherboard is not powered, BIOS cannot keep its settings and all of them are reset, including current date and time. If your computer is quite old, it is very likely that your battery is dead. We strongly recommend to replace it. It is not hard, and the process doesn’t require any special engineering skills. In most home and even enterprise devices a standard 3V CR2032 battery is used in BIOS.
If the battery replacement hasn’t helped, check the state of the jumper used to reset BIOS settings (The jumper is located close to the battery bay and is marked as CMOS / CLEAR / RESET). Somebody may have left it in the RESET position. Thus, each time when your motherboard is powered, BIOS settings are reset. Move the jumper to its normal position.
The next option is to update BIOS firmware of your motherboard. See how to do it on the website of your hardware vendor. Newer firmware often has different bugs fixed.
Windows: Set Clock Synchronization with time.windows.com
If your date/time settings in Windows are constantly changing, first of all you should check the current time zone settings and the parameters of time synchronization with the external time server. In Windows 10, you can see the current time settings in the Control Panel -> Clock and Region -> Date and Time. In this example, you can see, that the time zone UTC + 01 is specified, and Daylight Saving Time is enabled.
If your computer is not joined to the AD domain, check its time synchronization settings with the external time source (NTP time server). To do it, click Internet Time tab and make sure that the automatic synchronization with time.windows.com server is set.
Troubleshooting time synchronization for AD domain-joined computers
If your computer is part of an Active Directory domain, you need to understand the architecture of time synchronization in the AD domain.
The following time synchronization scheme is used in the Active Directory domain:
- The root domain controller in the AD forest, to which the FSMO role of the PDC emulator belongs, is a time source for all other DCs of this domain;
- Other DCs synchronize time with PDC;
- Ordinary domain members (servers and workstations) synchronize time with the nearest available domain controller according to the AD topology.
Root PDC can synchronize its time with both an external source and with itself (by default).
You can find a domain controller with the PDC role with the command:
netdom /query fsmo
To configure time synchronization with an external NTP server on the PDC, the following commands are used.
Configure external time sources:
w32tm /config /manualpeerlist:"0.nl.pool.ntp.org,0x1 1.nl.pool.ntp.org,0x1 2.nl.pool.ntp.org,0x1 3.nl.pool.ntp.org,0x1"
Make this DC a reliable time source for the clients:
w32tm /config /reliable:yes
Restart w32 time server to synchronize DC time with nl.pool.ntp.org time servers:
net stop w32time && net start w32time
You can view the synchronization source and status:
w32tm /query /peers
Start synchronization in manual mode:
w32tm /resync /rediscover
Windows & Linux Showing Different Times When Dual Booting
We should separately consider the cases when two operation systems (Windows & Linux) are installed on a computer in Dual Boot configuration. You can come across the problem that after booting to another system (booting to Linux after Windows) the time is several hours ahead or late of the actual time.
Windows and Linux work with BIOS time differently. They are using two different time formats: UTC and localtime.
GNU/Linux operation systems (including Mac OS X) assume the time in BIOS is in UTC format (GMT). Accordingly when booting, Linux converts the UTC time by adding (or distracting) the offset of the current time zone selected by the user. It means that in order to get the local time for Athens time zone UTC+2, Linux will add 2 hours.
Windows thinks that time in BIOS is kept in the localtime format, and if you have specified a new time zone or synchronized time with the external source, the system will make corresponding changes to the local time in BIOS. Linux (Ubuntu, in my case) thinks that time in BIOS is specified in UTC format and adds extra time zone offset. This is the reason why time gets wrong when switching from Linux to Windows and vice versa.
To fix it, you should make Windows use UTC time format in RealTimeIsUniversal registry parameter.
reg add "HKLMACHINE\System\CurrentControlSet\Control\TimeZoneInformation" /v RealTimeIsUniversal /t REG_DWORD /d 1 /f
reg add HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation /v RealTimeIsUniversal /t REG_QWORD /d 1
Also, disable time synchronization with the Internet in Windows, since at each time update Windows will reset UTC time to local.
sc config w32time start= disabled
Restart your Windows.
Or you can make Linux use local time. In Ubuntu 15.04 or higher, you can use the timedatectl tool:
timedatectl set-local-rtc 1
HPE Servers with Windows Server: Offset in the System Time After Restart
One of my remote customers came across an interesting problem after a time zone change on HPE DL/ML Gen9 servers running Windows Server 2008 R2 / 2012 R2. As it turned out, when changing a system time or a time zone on HP ProLiant Gen9 servers (and on one of HP ProLiant DL580 Gen8 servers), system time was not saved and was reset to the previous one after the restart. The problem occurred on the servers, on which Windows Server booted in the Legacy mode (with native UEFI boot, there weren’t any time change problems).
The following event appeared in the system log:
The system time has changed to 2019-01-29T12:12:28.500000000Z from 2019-01-29T13:12:27.923115700Z.
Change Reason: System time synchronized with the hardware clock.
As a solution of this problem, HP suggests to update ROM version to at least 1.5. This is the version of ROM-Based Setup Utility (RBSU) that has no time reset bug.
Or as a workaround solution, you can set that BIOS provides Windows the UTC system time (instead of the local time). To do it, as we have already told above, you must create a parameter with the name RealTimeIsUniversal and the value 1 in the registry key HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation.