Compare server time with other server. Some time we require to compare local server time with other server time, use the below command to compare the time with other server time. (o:+s) and a very basic stripchart of the offset. The first output line of w32tm will also resolve the name of the time server (time.windows.com) to an IP (UDP port 123 is reserved for NTP). This is important because time.windows.com does not refer to a single server but rather to a pool of.
Is it viable to use
w32tm.exe
's option stripchart
to judge the time variance of two hosts (within a very small margin of error)? Note that w32tm.exe
's stripchart
function is separate than the algorithm used by the Windows Time
service itself.
If not, what are some alternate methods?
Thanks,
Matt
mbrownnyc
mbrownnycmbrownnyc
2 Answers
The answer to your first question is 'Yes, w32tm.exe (Windows Time) is able to measure the time variance of two network hosts within a very small margin of error (relative term.)'
The answer to your second question is 'Yes, there are better ways to measure time variance between two hosts. Microsoft says so right here. They point you to NIST, which lists a whole bunch of other pieces of software (and hardware) that is probably better than w32tm.exe. I'm sure many of them are, since Microsoft clearly does not support w32tm.exe as an ultra high precision tool.'
Windows Time (and w32tm.exe) are RFC 1305 (NTPv3) compliant, which includes compensating for network latency. Source and Source. Compensating for network latency is one of the very basic features of the network time protocol. (See Marzullo's algorithm, which is what NTPv3 uses.)
What frustrates me about your question is that high precision is so important to you, but you don't give any hints as to what exact precision you need. 1 second? 1 millisecond? 1 nanosecond? General purpose computers have a clock resolution that is bound to the frequency of clock interrupts received by the processor, which is usually controlled by a crystal oscillator that runs at 32.768 KHz (a power of two,) but that's sensitive to temperature, voltage, etc. The HAL on a typical Windows machine defaults to configuring the real-time clock to fire every 15.6 milliseconds, or about 64 times a second. However, you can still crank the RTC down to 1ms, and you can also subdivide that 15.6 millisecond time slice via software into even smaller slices for high-performance applications. Regardless, the NTP timestamp itself is a 64-bit unsigned fixed point number and so has a theoretical limit of about 232 picoseconds of precision, but the Windows Time implementation does not even approach that. Windows Time displays an NTP precision of -6 and doesn't support some of the latest and greatest NTP algorithms so in reality it could probably never reliably produce a precision tighter than one hardware clock tick, or plus or minus 16 milliseconds.
General purpose operating systems are not extraordinarily great clocks, especially if the time keeping algorithms are implemented in user mode where the executing threads get preempted constantly. Highly precise clocks are expensive.
The picture above is the frequency of clock interrupts on the system. Note that even clock interrupts (IRQL 28 on 32-bit Windows and IRQL 13 on 64-bit Windows) can be preempted by higher interrupts, such as inter-processor interrupts, and can cause accurate time accounting to be deferred, if even by a nanosecond.
So back to NTP.
w32tm /stripchart /computer:10.0.1.8
is a perfectly valid way to test the time delta between one Windows machine and another. It does account for network latency, which is implied by it being NTPv3 compliant as we discussed above. But don't take my word for it. You can see the transaction for yourself in a Wireshark trace (client packet sent by w32tm.exe to a Windows NTP server):
Microsoft does not guarantee sub-second accuracies using Windows Time, because they do not need to support that in order for any of their products to work. However, that does not mean that w32tm.exe is not still capable of sub-second accuracy.
If you truly need more accurate time than this, you might eek out an extra millisecond or 10 of precision with another implementation of NTP that uses slightly different algorithms. But if you really need more accurate time, I personally wouldn't suggest NTP at all. I'd wire a cesium clock straight up to your machine and not use a preemptive operating system.
Edit 5/2/2017: The above information is out of date and does not necessarily apply to Windows Server 2016 and beyond. Microsoft has made some serious improvements to the accuracy of Windows Time in later operating systems.
Ryan RiesRyan Ries
I can not locate whether
w32tm.exe
's stripchart
accounts (or how it accounts) for latency and jitter. Instead, I located a thread on the ntp mailing list that directed the user(s) to three additional solutions that do measure latency and jitter:
- satsignal's NTP Monitor (disqualified since poll times are no less than 60 seconds)
- satsignal's NTP Plotter (plots historical loopstats files from ntpd)
- meinberg's NTP Time Server Monitor (requires a local ntpd service)
Not the answer you're looking for? Browse other questions tagged timentpw32time or ask your own question.
-->
Applies To: Windows Server 2003, Windows SBS 2003, Windows Vista, Windows XP, Windows Home Server 2011, Windows HPC Server 2008 R2, Windows Server 2008, Windows 7, Windows Server 2003 R2, Windows Server 2008 R2, Windows Essential Business Server, Windows Server 2008 Foundation, Windows SBS 2008, Windows Server 2008 R2 Foundation, Windows Home Server, Windows Server 2012, Windows HPC Server 2008, Windows 8
You can use the W32tm.exe tool to configure Windows Time service (W32time) settings. You can also use W32tm.exe to diagnose problems with the time service. W32tm.exe is the preferred command-line tool for configuring, monitoring, or troubleshooting the Windows Time service. For examples of how you can use this command, see Examples.
Syntax
Parameters
Parameter
|
Description
|
---|---|
W32tm /?
|
W32tm command-line Help
|
W32tm /register
|
Registers the time service to run as a service, and adds default configuration to the registry.
|
W32tm /unregister
|
Unregisters the time service, and removes all configuration information from the registry.
|
w32tm /monitor
[/domain:<domain name>] [/computers:<name>[,<name>[,<name>...]]] [/threads:<num>]
|
Domain—Specifies which domain to monitor. If no domain name is specified, or neither the domain nor computers option is specified, the default domain is used. This option might be used more than once.
computers—Monitors the given list of computers. Computer names are separated by commas, with no spaces. If a name has a prefix of a ‘*’, it is treated as a primary domain controller (PDC). You can use this option more than once.
threads—Specifies the number of computers to analyze simultaneously. The default value is 3. The allowed range is 1 through 50.
|
w32tm /ntte <NT time epoch>
|
Converts a Windows NT system time, in (10^-7)s intervals from 0h 1-Jan 1601, into a readable format.
|
w32tm /ntpte <NTP time epoch>
|
Converts a Network Time Protocol (NTP) time, in (2^-32)s intervals from 0h 1-Jan 1900, into a readable format.
|
w32tm /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.
computer:<computer>—Specifies the computer that should resynchronize. If a computer is not specified, the local computer will resynchronize.
nowait—Do not wait for the resynchronization to occur; return immediately. Otherwise, wait for the resynchronization to complete before returning.
rediscover—Redetect the network configuration and rediscover network sources; then, resynchronize.
soft—This option is only provided for compatibility with older time servers and will resynchronize using existing error statistics..
|
w32tm /stripchart
/computer:<target>
[/period:<refresh>]
[/dataonly]
[/samples:<count>]
[/packetinfo]
[ipprotocol:<4|6>
|
Displays a strip chart of the offset between this computer and another computer.
computer:<target>—The computer to measure the offset against.
period:<refresh>—The time between samples, in seconds. The default value is 2 seconds.
Dataonly—Display only the data, without graphics.
samples:<count>—Collect <count> samples; then, stop. If a value is not specified, samples will be collected until the user types Ctrl+C is pressed.
packetinfo—Print out NTP packet response message.
Ipprotocol—Specify the IP protocol to use. The default is to use whatever is available.
|
w32tm /config
[/computer:<target>]
[/update]
[/manualpeerlist:<peers>]
[/syncfromflags:<source>]
[/LocalClockDispersion:<seconds>]
[/reliable:(YES|NO)]
[/largephaseoffset:<milliseconds>]
|
computer:<target>—Adjusts the configuration of <target>. If a value is not specified, the default is the local computer.
update—Notifies the time service that the configuration has changed, causing the changes to take effect.
manualpeerlist:<peers>—Sets the manual peer list to <peers>, which is a space-delimited list of Domain Name System (DNS) and/or IP addresses. When you are specifying multiple peers, this option must be enclosed in quotation marks (“).
syncfromflags:<source>—Sets what sources the NTP client should synchronize from. <source> should be a comma-separated list of these keywords (not case sensitive):
LocalClockDispersion:<seconds>—Configures the accuracy of the internal clock that W32time will assume when it cannot acquire time from its configured sources.
reliable:(YES|NO)—Set whether this computer is a reliable time source.
This setting is meaningful only on domain controllers.
largephaseoffset:<milliseconds>—Sets the time difference between local time and network time that W32time will consider to be a spike.
|
w32tm /tz
|
Displays the current time zone settings.
|
w32tm /dumpreg
[/subkey:<key>]
[/computer:<target>]
|
Displays the values that are associated with a given registry key.
The default key is HKLMSystemCurrentControlSetServicesW32Time
(the root key for the time service).
subkey:<key>—Displays the values that are associated with subkey <key> of the default key.
computer:<target>—Queries registry settings for computer <target>.
|
w32tm /query [/computer:<target>] {/source | /configuration | /peers | /status} [/verbose]
|
This parameter was first made available in the Windows Time client versions of Windows Vista, and Windows Server 2008.
Displays a computer's Windows Time service information.
computer:<target>—Query the information of <target>. If a value is not specified, the default value is the local computer.
source—Display the time source.
configuration—Display the configuration of run time and where the setting comes from. In verbose mode, display the undefined or unused setting also.
peers—Display a list of peers and their status.
status—Display Windows Time service status.
verbose—Set the verbose mode to display more information.
|
w32tm /debug {/disable | {/enable /file:<name> /size:<bytes> /entries:<value> [/truncate]}}
|
This parameter was first made available in the Windows Time client versions of Windows Vista and Windows Server 2008.
Enables or disables local computer Windows Time service private log.
disable—Disable the private log.
enable—Enable the private log.
truncate—Truncate the file if it exists.
|
Remarks
The Windows Time service is not a full-featured NTP solution that meets time-sensitive application needs, and it is not supported by Microsoft as such. For more information, see article 939322 in the Microsoft Knowledge Base (http://go.microsoft.com/fwlink/?LinkID=179459).
If you have questions about the Windows Time service, please post them to the Directory Services forum (http://go.microsoft.com/fwlink/?LinkId=195451).
Examples
If you want to set the local Windows Time client to point to two different time servers, one named ntpserver.contoso.com and another named clock.adatum.com, type the following command at the command line, and then press ENTER:
For a list of valid NTP servers that are available on the Internet for external time synchronization, see article 262680 in the Microsoft Knowledge Base (http://go.microsoft.com/fwlink/?LinkID=60401).
If you want to check the Windows Time client configuration from a client computer running Windows 7 that has a host name of CONTOSOW1, run the following command:
The output of this command is a list of configuration parameters that are set for the Windows Time client.