Windows Time Service Tools and Settings | Microsoft Learn
The Windows Time service (W32Time) synchronizes the date and time for all computers managed by Active Directory Domain Services (AD DS). This article covers the various tools and settings used to manage W32Time.
By default, a computer that's joined to a domain synchronizes time through a domain hierarchy of time sources. However, sometimes a computer is manually configured to synchronize from a specific time source, perhaps because it was formerly not joined to a domain. In this case, you can reconfigure the computer to begin automatically sourcing its time from the domain hierarchy.
Most domain-joined computers have a time client type of Net Time 5 Directory Service (NT5DS), which means that they synchronize time from the domain hierarchy. An exception is the domain controller, which functions as the primary domain controller (PDC) emulator operations master for the root forest domain. The PDC emulator operations master in turn is configured to synchronize time with an external time source.
You can achieve down to one-millisecond time accuracy in your domain. For more information, see Support boundary for high-accuracy time and Accurate Time for Windows Server 2016.
Network port
W32Time follows the Network Time Protocol (NTP) specification, which requires the use of User Datagram Protocol (UDP) port 123 for all time synchronization. Whenever the computer synchronizes its clock or provides time to another computer, it happens over UDP port 123. W32Time reserves this port as the destination port.
Note
-
NTP servers typically listen on UDP port 123 for requests and respond from the same port, which is also true for the built-in W32Time NTP server.
-
You can enable or disable the built-in W32Time NTP client and NTP server independently. Both share UDP port 123 for their functions.
-
The built-in W32Time NTP client can only use UDP 123 as the source port.
-
If your computer has multiple network adapters (it's multi-homed), you can't enable W32Time based on a network adapter.
Command-line parameters for W32Time
You can use the w32tm command to configure W32Time settings and diagnose computer time problems. The w32tm command is the preferred command-line tool for configuring, monitoring, and troubleshooting W32Time. Membership in the local Administrators group is required to run this tool locally, and membership in the Domain Admins group is required to run this tool remotely.
To use w32tm, take the following steps:
-
Select Start, and then enter cmd. Right-click Command Prompt, and then select Run as administrator.
-
At the command prompt, enter w32tm followed by the applicable parameters.
| Parameter | Description |
| --- | --- |
| /? | Displays the w32tm command-line help. |
| /config [/computer:<target>] [/update] [/manualpeerlist:<peers>] [/syncfromflags:<source>] [/LocalClockDispersion:<seconds>] [/reliable:(YES|NO)] [/largephaseoffset:<milliseconds>] | /computer:<target>: Adjusts the configuration of <target>. If not specified, the default target is the local computer.<br>/update: Notifies W32Time that the configuration is changing, causing the changes to take effect.<br><br>/manualpeerlist:<peers>: Sets the manual peer list to <peers>, which is a space-delimited list of Domain Name System (DNS) or IP addresses. When you specify multiple peers, this option must be enclosed in quotation marks.<br><br>/syncfromflags:<source>: Sets the sources that the NTP client should synchronize from. The <source> value should be a comma-separated list of the following keywords (not case sensitive):<br><br>- MANUAL: Include peers from the manual peer list.<br>- DOMHIER: Synchronize from a domain controller (DC) in the domain hierarchy.<br><br><br>/LocalClockDispersion:<seconds>: Configures the accuracy of the internal clock that W32Time uses when it can't acquire time from its configured sources.<br><br>/reliable:(YES|NO): Sets whether this computer is a reliable time source. This setting is only meaningful on domain controllers.<br><br>- YES: This computer is a reliable time service.<br>- NO: This computer isn't a reliable time service.<br><br><br>/largephaseoffset:<milliseconds>: Sets the time difference between local and network time that W32Time considers a spike. |
| /debug {/disable | {/enable /file:<name> /size:/<bytes> /entries:<value> [/truncate]}} | Enables or disables the local computer W32Time private log.<br>/disable: Disables the private log.<br><br>/enable: Enables the private log.<br><br>- file:<name>: Specifies the absolute file name.<br>- size:<bytes>: Specifies the maximum size for circular logging.<br>- entries:<value>: Contains a list of flags, specified by number and separated by commas, that specifies the types of information that should be logged. Valid values are 0 to 300. A range of numbers is valid, as are single numbers, such as 0-100,103,106. A value of 0-300 is for logging all information.<br><br><br>/truncate: Truncates the file if it exists. |
| /dumpreg [/subkey:<key>] [/computer:<target>] | Displays the values associated with a given registry key.<br>The default key is HKLM\System\CurrentControlSet\Services\W32Time (the root key for W32Time).<br><br>/subkey:<key>: Displays the values associated with subkey <key> of the default key.<br><br>/computer:<target>: Queries registry settings for computer <target>. |
| /monitor [/domain:<domain name>] [/computers:<name>[,<name>[,<name>...]]] [/threads:<num>] | Monitors W32Time.<br>/domain: Specifies which domain to monitor. If no domain name is given, and the /domain and /computers options aren't specified, the default domain is used. This option can be used more than once.<br><br>/computers: Monitors the given list of computers. Computer names are separated by commas, with no spaces. If a name is prefixed with an asterisk (*), the computer is treated as a PDC. This option can be used more than once.<br><br>/threads: Specifies the number of computers to analyze simultaneously. The default value is 3. The allowed range is 1-50. |
| /ntpte <NTP time epoch> | Converts an NTP time (measured in 2^-32^-second intervals starting from 0h 1-Jan 1900) into a readable format. |
| /ntte <NT time epoch> | Converts a Windows NT system time (measured in 10^-7^-second intervals starting from 0h 1-Jan 1601) into a readable format. |
| /query [/computer:<target>] {/source | /configuration | /peers | /status} [/verbose] | Displays the computer's W32Time information.<br>/computer:<target>: Queries the information of <target>. If not specified, the default value is the local computer.<br><br>/source: Displays the time source.<br><br>/configuration: Displays the runtime configuration and the source of the settings. In verbose mode, this parameter also displays the undefined or unused settings.<br><br>/peers: Displays a list of peers and their status.<br><br>/status: Displays the W32Time status.<br><br>/verbose: Turns on verbose mode to display more information. |
| /register | Registers W32Time to run as a service and adds its default configuration information to the registry. |
| /resync [/computer:<computer>] [/nowait] [/rediscover] [/soft] | Tells a computer that it should resynchronize its clock as soon as possible, throwing out all accumulated error statistics. The NTP client requires UDP 123 as the source port. <br>/computer:<computer>: Specifies the computer that should resynchronize. If no computer is specified, the local computer resynchronizes.<br><br>/nowait: Doesn't wait for resynchronization to occur. Instead, it returns immediately. If this option isn't present, the command waits for resynchronization to finish before returning.<br><br>/rediscover: Redetects the network configuration, rediscovers network sources, and then resynchronizes.<br><br>/soft: Resynchronizes by using existing error statistics. This option is used for compatibility purposes. |
| /stripchart /computer:<target> [/period:<refresh>] [/dataonly] [/samples:<count>] [/rdtsc] | Displays a strip chart of the offset between this computer and another computer. The NTP client uses an ephemeral UDP source port to communicate to the server to prevent conflicts with the built-in NTP client.<br>/computer:<target>: Specifies the computer to measure the offset against.<br><br>/period:<refresh>: Specifies the time between samples, in seconds. The default value is 2.<br><br>/dataonly: Displays the data only, without graphics.<br><br>/samples:<count>: Collects <count> samples, and then stops. If not specified, samples are collected until Ctrl+C is selected./rdtsc: For each sample, prints comma-separated values along with the headers RdtscStart, RdtscEnd, FileTime, RoundtripDelay, and NtpOffset instead of the text graphic.<br><br>- RdtscStart: The Read Time Stamp Counter (RDTSC) value collected just before the NTP request is generated.<br>- RdtscEnd: The RDTSC value collected just after the NTP response is received and processed.<br>- FileTime: The local FILETIME value used in the NTP request.<br>- RoundtripDelay: The time elapsed in seconds between generating the NTP request and processing the received NTP response, computed as per NTP roundtrip computations.<br>- NTPOffset: The time offset in seconds between the local computer and the NTP server, computed as per NTP offset computations. |
| /tz | Displays the current time zone settings. |
| /unregister | Unregisters W32Time and removes all its configuration information from the registry. |
Set the client to use two time servers
To set a client computer to point to two different time servers, one named ntpserver.contoso.com and another named clock.adatum.com, run the following command:
w32tm /config /manualpeerlist:"ntpserver.contoso.com clock.adatum.com" /syncfromflags:manual /update
Set the client to sync time automatically from a domain source
Suppose you have a client computer that currently synchronizes time by using a manually specified computer. To configure the client computer to synchronize time automatically from the Active Directory domain hierarchy, run the following command:
w32tm /config /syncfromflags:domhier /update
net stop w32time
net start w32time
Check the client time configuration
To check a client configuration from a Windows-based client computer that has a host name of contosoW1, run the following command:
w32tm /query /computer:contosoW1 /configuration
The output of this command lists W32Time configuration parameters that are set for the client.
Since Windows Server 2016, improvements to the time synchronization algorithms support alignment with Request for Comments (RFC) specifications. Therefore, if you want to set the local time client to point to multiple peers, we recommend that you prepare three or more time servers.
If you have only two time servers, you should specify the NtpServerUseAsFallbackOnly flag (0x2) to deprioritize one of them. For example, if you want to prioritize ntpserver.contoso.com over clock.adatum.com, run the following command:
w32tm /config /manualpeerlist:"ntpserver.contoso.com,0x8 clock.adatum.com,0x2" /syncfromflags:manual /update
Also, you can run the following command and read the value of NtpServer in the output:
reg query HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters
Configure a computer clock reset
In order for w32tm to reset a computer clock, it first checks the offset CurrentTimeOffset, also known as Phase Offset, between the current time and the computer clock time to determine whether the offset is less than the MaxAllowedPhaseOffset value.
-
CurrentTimeOffset≤MaxAllowedPhaseOffset: Adjust the computer clock gradually by using the clock rate. -
CurrentTimeOffset>MaxAllowedPhaseOffset: Set the computer clock immediately.
To adjust the computer clock by using the clock rate, w32tm then calculates a PhaseCorrection value. This algorithm varies depending on the version of Windows:
- Windows Server 2016 and later versions:
PhaseCorrection_raw = (CurrentTimeOffset) ÷ (16 × PhaseCorrectRate × pollIntervalInSeconds)
MaximumCorrection = (CurrentTimeOffset) ÷ (UpdateInterval ÷ 100)
PhaseCorrection = min(PhaseCorrection_raw, MaximumCorrection)
- Windows Server 2012 R2 and earlier versions:
PhaseCorrection = (CurrentTimeOffset) ÷ (PhaseCorrectRate × UpdateInterval)
All versions of Windows use the same final equation to check PhaseCorrection:
PhaseCorrection ≤ SystemClockRate ÷ 2
Note
The following operating systems apply cumulative updates from KB5006744 onward, so they use the formula for Windows Server 2016 and later versions:
-
Windows Server 2025
-
Windows Server 2022
-
Windows Server 2019 version 1809
-
Windows 11
-
Windows 10 version 1809
In these equations, PhaseCorrectRate, UpdateInterval, MaxAllowedPhaseOffset, and SystemClockRate are measured in units of clock ticks. On Windows systems, one millisecond equals 10,000 clock ticks.
You can configure the MaxAllowedPhaseOffset value in the registry. However, the registry parameter is measured in seconds instead of clock ticks.
To see the SystemClockRate and pollIntervalInSeconds values (measured in seconds), open a Command Prompt window and then run the following command: w32tm /query /status /verbose. This command produces output that resembles the following lines:
```output
Leap Indicator: 0(no warning)
Stratum: 1 (primary reference - syncd by radio clock)
Precision: -23 (119.209ns per tick)
Root Delay: 0.0003538s
Root Dispersion: 0.0100002s
ReferenceId: 0x00000000 (unspecified)
Last Successful Sync Time: 5/23/2023 7:51:39 PM
Source: VM IC Time Synchronization Provider
