Have you ever had issues with your computer’s clock not keeping the correct time? This used to be a big problem with computers, but with the introduction of the Network Time Protocol (NTP), this is no longer an issue. NTP runs in the background and synchronizes your computer’s clock with an external clock, typically either a satellite or an atomic clock reachable on the Internet. This ensures your computer’s clock is always accurate.
Before computers were connected together on the Internet, it wasn’t such a big deal if your computer’s clock was off just a little bit. Now, having your computer’s clock off can be a big issue. You can run into issues that confuse applications, such as time-traveling emails that arrive before they are sent.
Networks generally have only one NTP time server per geographic site, and that time server will get its time externally. On a windows domain, a domain controller in the site is usually the time server. If there is a firewall between the NTP client and server, then UPD port 123 will need to be opened through the firewall. The preferred setup is to have a GPS-based time server device that gets its time from a satellite and have the PDC emulator get its time from that device. The domain controllers get their time from the PDC emulator, and the time clients synchronize their time with their respective domain controllers.
The primary time server itself gets its time from one of two sources: a time server on the internet, or an internal time server that gets its time from a GPS satellite. The best practice is to use the satellite so you do not have to open a hole in the firewall to allow internet communications.
NTP uses the User Datagram Protocol (UDP) as its transport protocol and operates at the network layer of the OSI model. The NTP protocol uses UDP port 123 to communicate.
On Windows 11, NTP is set by default to synchronize time using the Internet server time.windows.com. You can see this by going to the settings app and looking at the date and time. To actually configure it, though, you will need to go to the old control panel app, which lets you change the time server. You will see a short list of time servers, which lets you select between available servers. You can type in the name of the time server you want to use and select OK. This will permanently add it to the list.
Advanced users can manage the current list of servers to choose from using regedit. Since it is under HKLM, it requires administrative privileges to make changes. Run regedit as an administrator and go to:
Alternatively, the w32tm.exe command line utility is still available.
Here are some example command lines to use for NTP:
Check current NTP Status: w32tm /query /status
Manually synchronize the clock: w32tm /resync
Display current time zone: w32tm /tz
If your computer is having issues keeping the correct time, you can use the above command to check the current status. The next place to look is the event viewer. Time issues will be in the System logs. You should filter the source to “Time-Service” and “Time-Service-PTP-Provider.” Some common NTP errors in the event logs include not being able to connect to the specified NTP server and the service not starting.