Time Service Utility.


  Register the time service, and add default config to the registry:
      W32TM /register

  Unregister the time service, and remove config from the registry:
      W32TM /unregister

  The domain/computers to monitor:
      W32TM /monitor [/domain:domain_name] [/computers:name[,name[,name...]]] [/threads:num] [/ipprotocol: <4|6>] [/nowarn]

  Convert a Windows NT system time, in (10^-7)s intervals from 0h 1-Jan 1601, into a readable format.
      W32TM /ntte NT_Time_Epoch

  Converts a Network Time Protocol (NTP) time, in (2^-32)s intervals from 0h 1-Jan 1900, into a readable format:
      W32TM /ntpte Network_Time

  Tell a computer that it should resynchronize its clock as soon as possible, discarding all accumulated error stats:
      W32TM /resync [/computer:computer] [/nowait] [/rediscover] [/soft]

  Display a strip chart of the offset between this computer and another computer:
      W32TM /stripchart /computer:target [/period:refresh] [/dataonly]
              [/samples:count] [/packetinfo] [/ipprotocol:<4|6>] [rdtsc]

  Adjust the configuration of target (default=local computer):
      W32TM /config [/computer:target] [/update] [/manualpeerlist:peers]
              [/syncfromflags:source] [/LocalClockDispersion:seconds]
                 [/reliable:(YES|NO)] [/largephaseoffset:milliseconds]

  Display the current time zone settings:
      W32TM /tz

  Display the values that are associated with a given registry key on target (default=local computer):
      (default/root key is HKLM\System\CurrentControlSet\Services\W32Time)
      W32TM /dumpreg [/subkey:key] [/computer:target]

  Display a computer's Windows Time service information:
      W32TM /query [/computer:target] { /source | /configuration | /peers | /status } [/verbose]

  Enable or disable a local computer Windows Time service private log:
      W32TM /debug {/disable | {/enable /file:name /size:bytes /entries:value [/truncate]}}

  Display the status of leap seconds on the local machine:
      W32TM /leapseconds /getstatus [/verbose]


   Domain  The 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 Monitor 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.

   computer The computer to act upon, by default the local computer.

   threads  The number of computers to analyze simultaneously. 1-50, default=3.

 ipprotocol Select IPv4 or ipv6 (default=whatever is available).

            A hex value representing a 64 bit integer that represents the number of seconds
            elapsed since 1900-01-01 00:00:00 (can be supplied as either Hex or integer)
            In reverse byte order, the first hex byte is the least significant:
            (1900-01-01 00:00:01 is encoded as 0x01000000)

            Display the configuration of run time and where the setting comes from.
            In verbose mode, display the undefined or unused setting also.

   /Dataonly Display only the data, without graphics.

   /disable Disable the private log.

   /enable  Enable the private log.
              file:name   The absolute file name.
              size:bytes  The maximum size for circular logging.
              entries:value  Contains a list of flags, specified by number and separated by commas, that specify
                             the types of information that should be logged. Valid numbers are 0 to 300.
                             A range of numbers is valid, in addition to single numbers, such as 0 through 100,103,106.
                             Value 0-300 is for logging all information.

   /Ipprotocol 4|6
            Specify the IP protocol to use. Default = use whatever is available.

            Sets the time difference between local time and network time that W32time will consider to be a spike. 

            Configures the accuracy of the internal clock that W32time will assume when
            it cannot acquire time from its configured sources.

            Set 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 (").

   /nowait  Do not wait for the resynchronization to occur; return immediately.
            Otherwise, wait for the resynchronization to complete before returning.

   /nowarn  Do not display a warning message.

            Print out NTP packet response message.

   /peers   Display a list of peers and their status.

            The time between samples, in seconds. The default value is 2 seconds.

            Set whether this computer is a reliable time source.
            This setting is meaningful only on domain controllers.

   /rdtsc   Display the TSC values (time for NTP response) and time offset data in CSV format.
            The output displays TSC and FILETIME values captured before the NTP request is sent,
            TSC value after an NTP response is received along with NTP roundtrip and time-offset values.

   /rediscover  Redetect the network configuration and rediscover network sources;
            then, resynchronize.

            Collect count samples; then, stop.
            If a value is not specified, samples will be collected until Ctrl+C is pressed.

   /soft    This option is only provided for compatibility with older time servers and will
            resynchronize using existing error statistics. Not useful.

   /source  Display the time source.

   /status  Display Windows Time service status.

            Sets what sources the NTP client should synchronize from. source should be a
            comma-separated list of these keywords (not case sensitive):
              MANUAL — Include peers from the manual peer list.
              DOMHIER — Synchronize from a domain controller in the domain hierarchy.
              NO     — Do not synchronize from any server.
              ALL    — Synchronize from both manual and domain peers.

   /update  Notify the time service that the configuration has changed, causing the changes
            to take effect.

   /verbose Set the verbose mode to display more information.

   /truncate Truncate the file if it exists.

   /?       Display help.

The W32Time service is not a full-featured Network Time Protocol (NTP) solution that meets time-sensitive needs.

By default the Windows Time service (w32time) will synchronize it's time once per week.
This can be extended to daily by setting a Scheduled Task to start the service and run w32tm /resync.

The options /debug, /packetinfo and /ipprotocol are available from Windows Vista and above.

/stripchart /packetinfo - will output three timestamps - The first hex number is byte order reversed NTP date, followed by the ANSI date (number of days since 1st Jan 1601) followed by the date/time in readable/local format.

The option /ntpte - will output three timestamps - The first hex number is an NTTE date (as also understood by w32tm.exe /ntte ), followed by the ANSI date (number of days since 1st Jan 1601) followed by the date/time in readable/local format.

The option /ntte - will output two timestamps - first the ANSI date (number of days since 1st Jan 1601) followed by the date/time in readable/local format.

A computer that is a member of a domain is configured by default to synchronize from the domain hierarchy, manually-specified synchronization is most useful for the forest root of the domain or for computers that are not joined to a domain.

Secure Time Seeding

Microsoft ship a feature called Secure Time Seeding which is turned on by default in Windows Server 2016+.

Secure Time Seeding produces a Date/Time reference during system boot when the system is unable to communicate securely with other sources to obtain the correct time. For database servers and email hosting servers, having an accurate date/time setting at all times is critical.

During outgoing SSL handshakes, Secure Time Seeding will read the "ServerUnixTime" from the security certificates. Both RFC 2246 and RFC 4346 state the following use for the gmt_unix_time field:

The current time and date in standard UNIX 32-bit format (seconds since the midnight starting Jan 1, 1970, GMT, ignoring leap seconds) according to the sender's internal clock. Clocks are not required to be set correctly by the basic TLS Protocol; higher-level or application protocols may define additional requirements.

Though for many servers the date/time is present and correct. This will on occasion result in a date/time being set to several days or weeks into the future. More details here.

Secure Time Seeding can be turned off by setting the UtilizeSSLTimeData registry key to 0 (False) – this will make the system time dependent on the battery backed CMOS time from bootup until the first Time Server sync:

REG add HKLM\SYSTEM\CurrentControlSet\Services\w32time\Config /v UtilizeSslTimeData /t REG_DWORD /d 0 /f 

Then reread the configuration:

W32tm.exe /config /update
NET stop w32time
NET start w32time

Public NTP servers

url Public NTP server Stratum  
time.nist.gov NIST Internet Time Service 1 From the NIST Physical Measurement Laboratory, maintains the standard for frequency and time interval for the United States.
Also time-a-wwv.nist.gov ... time-d-wwv.nist.gov
time.apple.com Apple time server. 1 Also for Europe: time.euro.apple.com and time.asia.apple.com.
time.google.com Google time server. 1 Serves leap-smeared time, to smoothly handle leap seconds with no disruptive events.
Also time1.google.com ... time4.google.com
pool.ntp.org NTP Pool project 1-3 A very large virtual cluster of timeservers. IPv4 only. Rules of Engagement.
Many standard Linux distributions use this.
Also 0.pool.ntp.org ... 3.pool.ntp.org
time.windows.com Microsoft time server. 3 IPv4 only

Many other public NTP servers exist, choose one that is geographically close to your datacentre.

Standard and smearing servers should not be mixed.

A stratum 1 time server is directly connected to a reference clock and is at the top of the time server hierarchy. A stratum 2 time server receives the time from one, or more, stratum 1 time servers. Stratum 2 time servers are not significantly less accurate than stratum 1.


Set the local Windows Time client to point to two different time servers, one named 'time.nist.gov' and another ' time.apple.com':

W32TM.exe /config /manualpeerlist:"time.nist.gov time.apple.com" /syncfromflags:manual /update

Check the Windows Time client configuration from a client computer running Windows that has a host name of PC64

W32TM.exe /query /computer:PC64 /configuration

Compare the local computer time with time.windows.com

W32TM.exe /stripchart /computer:time.windows.com /dataonly /samples:5

Convert an NTTE formatted date into a readable format, if using hex, prefix with 0x:

W32TM.exe /ntte 0x01cf070000000000

W32TM.exe /ntte 130330610798428160

Convert an NTP formatted date into a readable format, if using hex, prefix with 0x:

W32TM.exe /ntpte 0x72386aa6917c63d8

“We have a normal.
 As you move outside of your comfort zone, what was once the unknown and frightening becomes your new normal” ~ Robin S. Sharma

Related commands

TZUTIL - Time Zone Utility.
TIME - Display or set the system time.
NSLOOKUP - Lookup IP addresses on a NameServer.
Microsoft.com - Set the clock back slowly by adjusting the values of PhaseCorrectRate / UpdateInterval.
EndRun - Hardware NTP Time Servers.
Convert Hex - Convert between Hex and Integer numbers.
Old New Thing - How to recognize date/time stamps (0x01=NTTE/Win32 FILETIME, 0x08=CLR System.DateTime)

Copyright © 1999-2024 SS64.com
Some rights reserved