Windows Time Service: How to Configure and Sync
In this article
Yes, you can configure the Windows Time Service (W32Time) to synchronize your PC’s clock with an external network time server. This ensures accurate timestamps for security certificates, file synchronization, and domain authentication. The primary requirement is administrative access to the system, as modifying time settings requires elevated privileges.
What You'll Need
- A Windows PC running Windows 10 or Windows 11 (steps may vary slightly for older versions).
- Administrator rights on the local machine.
- Internet connectivity to reach public NTP servers.
- Command Prompt or PowerShell opened as Administrator.
Step-by-Step
- Open an Elevated Command Prompt: Click the Start menu, type
cmd, right-click "Command Prompt," and select "Run as administrator." If using PowerShell, search for it and select "Run as administrator." Note that menu labels may differ slightly depending on your Windows version. - Stop the Current Time Service: Before changing configuration, stop the service to prevent conflicts. Type the following command and press Enter:
net stop w32time - Configure the Time Source: Specify which NTP server your computer should trust. For most users, Microsoft’s default pool is reliable. Type this command to set the source:
w32tm /config /syncfromflags:manual /manualpeerlist:"time.windows.com,0x8 time.nist.gov,0x8"This command tells Windows to usetime.windows.comandtime.nist.govas fallback sources. The0x8flag indicates these are special poll intervals suitable for manual configuration. - Update the Local Clock: Force Windows to update its registry settings with the new configuration. Run:
w32tm /config /update - Rename the Service (Optional but Recommended): To ensure the service starts automatically if it fails, enable the reliable timer service feature. Run:
w32tm /resyncIf this command returns an error, proceed to the next step to manually restart the service. - Restart the Time Service: Start the service again to apply changes. Type:
net start w32time - Verify Synchronization: Check if the service is working correctly by querying its status. Run:
w32tm /query /statusLook for the "Source" line in the output. It should display one of the NTP servers you configured (e.g.,time.windows.com). If it shows "Local CMOS Clock," the sync has not yet succeeded.
Common Mistakes
One frequent error is forgetting to run commands as an administrator. Without elevated privileges, the system will deny permission to modify time settings, resulting in an "Access Denied" error. Another common mistake is configuring a private or internal NTP server without ensuring that server is actually reachable from your network. If the specified peer is offline or blocked by a firewall, Windows will fail to sync and revert to the local hardware clock.
Users also often skip the /update flag after changing configuration. This leaves the registry outdated until the next scheduled sync cycle, causing delays in applying new settings. Additionally, assuming that simply turning off "Set time automatically" in Settings resolves all issues is incorrect; the underlying W32Time service must still be properly configured via command line for domain environments or advanced troubleshooting.
Tips
If you are on a corporate network managed by Active Directory, do not manually configure NTP peers. Domain controllers typically handle time synchronization through the hierarchy, and overriding this can cause authentication failures across the domain. In such cases, rely on Group Policy to manage time settings.
For home users experiencing drift, consider adding multiple redundant NTP servers in the configuration command. If one server is unreachable, Windows will attempt the next one in the list. Always test connectivity to the NTP server using ping before configuring it, as DNS resolution issues can mimic time sync failures.
Troubleshooting
If the time service fails to sync, start with the simplest checks. First, verify your internet connection is active. Next, check the service status by running sc query w32time. If the state is not "RUNNING," start it manually with net start w32time.
If the service runs but still shows "Local CMOS Clock" in the status query, reset the configuration entirely. Stop the service, then run w32tm /unregister followed by w32tm /register. This reinstalls the service binaries. Afterward, restart the service and run w32tm /resync again.
Firewall interference is another common culprit. Ensure that UDP port 123 is open for outbound traffic. If you use third-party antivirus software, temporarily disable it to see if it blocks the time sync protocol. Finally, check the System Event Log for Event ID 8 or 1058, which indicate specific synchronization failures, and address the underlying cause reported there.
Frequently Asked Questions
Can I use a custom NTP server?
Yes. Replace time.windows.com in the configuration command with the IP address or hostname of your preferred NTP server. Ensure the server supports NTPv4 and is accessible from your network.
Why does my time drift even after syncing?
Drift usually indicates a failing motherboard battery (CMOS) or high CPU load preventing timely updates. Check the "Last Successful Sync Time" in the status query. If the interval between successful syncs is long, the hardware clock may be unstable.
How do I force an immediate resync?
Use the command w32tm /resync /rediscover. The /rediscover flag forces Windows to re-evaluate the network path to the time source, which can help if previous attempts failed due to temporary network issues.
Does this work on Windows Server?
Yes, but with caveats. On a Primary Domain Controller (PDC), you should configure it to sync with an external source like time.windows.com. Other domain controllers should sync from the PDC, not directly from external sources, to maintain consistency across the domain.
What if the command prompt says 'command not found'?
This is rare but possible if the system environment variables are corrupted. Try opening PowerShell instead, or navigate to C:\Windows\System32 where the w32tm.exe executable resides and run it from there.