2

Ever since virtualizing several physical servers into GCP, I have had an issue where anytime the servers(s) are rebooted the time is changed to be several hours ahead (I think it's 4 hours, but may be 6 hours). My local office is located in CST time zone and that is what we want the server to display. In GCP the virtual servers are in the us-central1a zone. On the virtual server, run the tzutil /g command it shows that the server is set to "central standard time". It also shows Central timezone if I click the clock on the toolbar then choosing "change date and time settings"

After the server has been rebooted (and reports wrong time) I can correct the time by clicking the "update now" options (found on toolbar clock, "change date and time settings", internet time tab, change settings" "update now" (this points to time server time.nist.gov).

This issue only began occurring after migrating into GCP so I believe it to be a Compute Engine issue and not an OS issue.

any thoughts on why this might be happening? I have this on occurring on all 4 windows servers that were migrated into Google Cloud. three are win2008r2, and one is Win2012r2

I appreciate any help that can be given to get this resolved, as I can't even reboot without connecting to the server afterwards and checking/fixing the time, I do have set a startup script to delay and then sync time after rebooting, but it has not worked 100% of the time, so this is more of a band-aid than a fix.

J. Murray
  • 1,460
  • 11
  • 19
Ricky
  • 61
  • 7

2 Answers2

2

I do have set a startup script to delay and then sync time after rebooting, but it has not worked 100% of the time, so this is more of a band-aid

Getting this script working is probably the solution, here. For what it's worth, you'd need to do the same thing on both Azure and AWS as well, since they also set Windows timezones to UTC by default using the same mechanism.

Normally all servers run on UTC time, its clients (applications, browsers, etc) set their timezones according to where they are, and its up to them to translate UTC time to whichever locale they are in. (Put another way, you wouldn't want a server with a million client connections to have to keep track of each client's timezone in order to work properly). In your case, the bottom line is that requiring a custom timezone on the server will also require a custom server configuration, and the behavior you're seeing is by design. That's why your best bet is to understand why the startup script isn't working like you expect it to.

For reference, these docs may be helpful:

Travis Webb
  • 14,688
  • 7
  • 55
  • 109
  • I understand about the GCP servers using UTC time and then later translating that into the various locales where the server resides... but that doesn't seem to be happening in my case. Since the my virtual instance resides in zone us-central1a Zone I would have thought it would translate the UTC time to the zone the instance was built in (and that the server is configured with) Additionally I find it strange that the other windows servers I've built in the cloud (rather than virtualized off a physical server) do not seem to have this same problem. I guess I'll keep tweaking the script. – Ricky Oct 04 '19 at 18:31
  • 1
    No, I'm saying it is **not** translated based on where the server resides, and it's not supposed to. Where the server resides is irrelevant, because servers are supposed to run on UTC time and not care about what time zone they are in. Please read the docs that I linked which will help clarify. – Travis Webb Oct 04 '19 at 20:25
0

If you looked at the VM instance logs in the GCP Console you'd see that VM BIOS reports time in UTC

2019/10/3 14:9:44 Begin firmware boot time

After a while BIOS hands over to the bootloader

2019/10/3 14:9:45 End firmware boot time
Booting from Hard Disk 0...

The OS boots up. Behind the scene the OS time service recognizes the system timezone, then sets up and synchronizes time with the time source. From that time forward running programs and services report events based on the local system time:

...
2019/10/03 09:10:05 GCEWindowsAgent: GCE Agent Started (version 4.6.0@1)

In the Windows Event Log you should see entries made by the Time-Service:

Log Name: System
Source: Time-Service
Level: Information

The time provider NtpClient is currently receiving valid time data from metadata.google.internal,0x1 (ntp.m|0x1|0.0.0.0:123->169.254.169.254:123).
The time service is now synchronizing the system time with the time source metadata.google.internal,0x1 (ntp.m|0x1|0.0.0.0:123->169.254.169.254:123).

In the command prompt you can ensure that the time configuration and state are correct:

C:\Users\user>systeminfo | find /i "Time"
System Boot Time:          10/3/2019, 9:09:49 AM
Time Zone:                 (UTC-06:00) Central Time (US & Canada)

Hence you don't need synchronizing time neither manually or with with a startup script. The time service will do it for you: to synchronize the system time right after the boot and to keep it in sync afterwards. All you need is to set correct Time zone and the Internet time server for Windows, and then make sure the time server is reachable via the network.

mebius99
  • 2,495
  • 1
  • 5
  • 9
  • Thanks mebius99, I think you are correct that time is being set to UTC. My servers are also correctly set to the correct time zone and point to a reachable time server. That is what has perplexed me, in that after I reboot (and time becomes incorrect) I can do nothing other than click "update now" for the time and it will revert to the correct time. Yes, when I run the command "systeminfo | find /i "Time" it shows the correct time zone for the system. – Ricky Oct 04 '19 at 18:23
  • mebius99, I took your advice and combed through the boot log. All the GCP logs show to be in CDT time (as expected) with logs "time"written" details showing details like "2019-09-24 21:19:46 -0500" So it appears it is trying to boot with the correct time, with all log times showing the same format CDT-0500. And as I mentioned earlier the server is set to CST time (UTC-0600). I do not see an GCE logs with showing an incorrect time. Only when i'm logged into the server before having it resync the time from a time server. – Ricky Oct 04 '19 at 19:14
  • If I get you right, the time service works as it should: the time gets synchronized some time after reboot. In case you can't wait for the time sync cycle completion, you log into the server and force time synchronization manually. Hence there is no time sync issues, right? – mebius99 Oct 10 '19 at 07:09
  • Mebisu99, The time only becomes incorrect is after a system reboot, and the time stays wrong until the time is either auto synchronized (sometime later) or it is done manually. – Ricky Oct 14 '19 at 22:23