Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I sync the computer's clock upon startup?

I have several servers hosted with GoGrid, and every time I reboot one of my cloud servers, the system clock is incorrect. The server isn't a member of a domain, so I just have the OS set to sync with an Internet time server. This only happens once a day, and I don't see an option to make this happen automatically upon reboot. So I'm left with writing some code to do it for me.

I created a batch file with the "w32tm /resync" command, and scheduled it to run on system startup, but it doesn't work because the network connection isn't available when the batch file is run. How can I cause the time sync to start after the OS is fully loaded and the network connection is available? I need the time to be correct ASAP after the computer boots so timestamps in my database will be correct.

like image 694
ccoxtn Avatar asked Jan 08 '09 21:01

ccoxtn


People also ask

Why is my computer clock not syncing?

If your computer is unable to sync with the time.windows.com time server, restart the Windows Time service. Then, try to connect to an alternative time server, such as the NTP.org time servers. You can manually add additional time servers by tweaking your Registry Editor settings.


2 Answers

In Windows 10, I went to services and enabled "Windows Time" service w32time to be automatic, that solved it for me.

My issue occured because I have a dual boot with Linux and for some reason Windows's clock is always off after I boot in Linux.

like image 148
Craig Avatar answered Oct 04 '22 15:10

Craig


As pointed out here this may be related to having a dual boot system with windows 10 and linux.

In my case the service was set to be run only manually and therefore was never triggered as one would suspect. Adjusting the service to be run automatically on startup within the services administration of windows solved the issue for me.

enter image description here

like image 20
user2265240 Avatar answered Oct 04 '22 17:10

user2265240