Benefits and Purposes of Windows Time Service

Many features in Windows Vista rely on accurate and synchronized time to function correctly. For example, if clocks are not synchronized to the correct time on all computers, Windows Vista authentication might falsely interpret logon requests as intrusion attempts and deny access to users.

With time synchronization, you can correlate events on different computers in an enterprise. With synchronized clocks on all of your computers, you ensure that you can correctly analyze events that happen in sequence on multiple computers. Windows Time Service automatically synchronizes a local computer’s time with other computers on a network to improve security and performance in your organization.

Overview: Using Windows Time Service in a Managed Environment

Computers keep the time on their internal clocks, which allows them to perform any function that requires the date or time. For scheduling purposes, however, the clocks must be set to the correct date and time, and they must be synchronized with the other clocks in the network. Without another method in place, these clocks must be set manually.

With time synchronization, computers set their clocks automatically to match another computer's clock. One computer maintains very accurate time, and then all other computers set their clocks to match that computer. In this way, you can set accurate time on all computers.

Windows Time Service is installed by default on all computers running Windows Server 2003 and Windows Vista. Windows Time Service uses Coordinated Universal Time (UTC), which is independent of time zone. Time zone information is stored in each computer's registry and is added to the system time just before it is displayed to the user.

By default, Windows Time Service starts automatically on computers running Windows Vista. In a domain, time synchronization takes place when Windows Time Service turns on during system startup and periodically while the system is running. In the default configuration, the Net Logon service looks for a domain controller that can authenticate and synchronize time with the client. When a domain controller is found, the client sends a request for time and waits for a reply from the domain controller. This communication is an exchange of Network Time Protocol (NTP) packets intended to calculate the time offset and round-trip delay between the two computers.

How Windows Time Service Communicates with Sites on the Internet

In Windows Vista, Windows Time Service automatically synchronizes the local computer's time with other computers on the network. The time source for this synchronization varies, depending on whether the computer is joined to a domain or to a workgroup.

When a Computer Running Windows Vista Is Part of a Workgroup

Within a workgroup, the default setting for the time synchronization frequency is set to "once per week," and this default setting uses the time.windows.com site as the trusted time synchronization source. This setting will remain until you manually set it otherwise. As an alternative, you could choose one or more computers to be a locally reliable time source, and configure Windows Time Service on those computers so that it uses a known accurate time source (special hardware or a time source available on the Internet). All other workgroup computers can be configured manually to synchronize their time with these local time sources.

When a Computer Running Windows Vista Is a Member of a Domain

Within a domain, Windows Time Service configures itself automatically, using the Windows Time Service that is available on the domain controllers.

Windows Time Service on a domain controller can be configured as either a reliable or an unreliable time source. By default, Windows Time Service on a computer running Windows Vista will attempt to synchronize its time source with servers that are indicated as reliable.

Communication Between Windows Time Service and the Internet

The following list describes various aspects of Windows Time Service data that is sent to and from the Internet and how the exchange of information takes place.

Specific information sent or received: The service sends information in the form of a Network Time Protocol (NTP) packet. For more information about Windows Time Service and NTP packets, see the references listed in “Related Links,” later in this section.

Default settings: For a description of the default settings, see "When a Computer Running Windows Vista Is Part of a Workgroup" or "When a Computer Running Windows Vista Is a Member of a Domain," earlier in this section.

Triggers and user notification: Windows Time Service is started when the computer starts. Additionally, the service will continue to synchronize time with the designated network time source and adjust the computer time of the local computer when necessary. Notification is not sent to the user.

Logging: Information related to the service is stored in the Windows System event log. The time and network address of the time synchronization source is contained in the Windows event log entries. Additionally, warning or error condition information related to the service is stored in the Windows System event log.

Encryption: Encryption is not used in the network time synchronization for domain peers. (Authentication, however, is used.)

Information storage: The service does not store information. All information that results from the time synchronization process is lost when the time synchronization service request is completed.

Port: NTP uses User Datagram Protocol (UDP) port 123 on time servers. If this port is not open to the Internet, you cannot synchronize your server to Internet NTP servers.

Protocol: The service on Windows Vista implements NTP to communicate with other computers on the network.

Ability to disable: Disabling the service is not recommended, because this might have indirect effects on applications or other services. Applications and services that depend on time synchronization, such as Kerberos V5 authentication protocol, may fail, or they may yield undesirable results if there is a significant time discrepancy among computers. Because most computers’ hardware-based clocks are imprecise, the differences between computer clocks on the network usually increase over time.

Controlling Windows Time Service to Limit the Flow of Information to and from the Internet

Group Policy can be used to control Windows Time Service for computers that are running Windows Vista to limit the flow of information to and from the Internet.

The synchronization type and NTP time server information can be managed and controlled through Group Policy. The Windows Time Service Group Policy object (GPO) contains configuration settings that specify the synchronization type. When the synchronization type is set to Nt5DS, Windows Time Service synchronizes its time resource with the network domain controller. Alternatively, setting the type attribute to NTP configures Windows Time Service to synchronize with an NTP time server that is specified by Domain Name System (DNS) name or IP address.

Clients on a managed network can be configured to synchronize computer clock settings to an NTP server on the network to minimize traffic to the Internet and to ensure that the clients synchronize to a single reliable time source. It is also possible (although not recommended) to disable time synchronization for computers running Windows Vista by using Group Policy. For more information, see "Procedures for Configuring Windows Time Service," later in this section.

How Windows Time Service Can Affect Users and Applications

Many Windows features and services depend on time synchronization. For example, the Kerberos V5 authentication protocol on a Windows Server 2003 domain has a default time synchronization threshold of five minutes. Computers that are more than five minutes out of synchronization on the domain will fail to authenticate using the Kerberos protocol. This time value is also configurable, allowing for greater or lesser thresholds. Failure to authenticate using the Kerberos protocol can prevent logons and access to Web sites, file shares, printers, and other resources or services within a domain.

When the local clock offset has been determined, the following adjustments are made to the time:

If the local clock time of the client differs from the time on the server by more than the threshold amount, Windows Time Service will change the local clock time immediately. The threshold is five minutes if the computer is part of a domain. It is one second if the computer is part of a workgroup. However, if a computer is part of a workgroup and the time differs from the time source by more than 15 hours, the time is not synchronized, as described later in this list.

If the local clock time of the client differs from the server by less than the threshold amount, the service will gradually synchronize the client with the correct time.

In a workgroup, if the local clock time of the client differs from the time on a time source by more than 15 hours, a workstation running Windows Time Service and using default settings will not synchronize with the time source. Such occurrences are rare, and are often caused by configuration setting errors. For example, if a user sets the date on the computer incorrectly, the time does not synchronize. Under these circumstances, most often the time is off by a day or more. Be sure to check the computer's calendar and ensure that the correct date has been set.

Configuration Settings for Windows Time Service

You can set the global configuration settings for Windows Time Service by using Group Policy. The settings that might be relevant for communication between Windows Time Service and the Internet are described in this subsection.

In Computer Configuration\Administrative Templates\System\Windows Time Service\Global Configuration Settings, there is only one setting that might, in certain scenarios, affect the way that Windows Time Service communicates when the computer is in a domain. This setting is AnnounceFlags, which controls whether this computer is marked as a reliable time server. A computer is not marked as reliable unless it is also marked as a time server. The settings are as follows:

0 Not a time server

1 Always a time server

2 Automatic time server, meaning the role is decided by Windows Time Service

4 Always a reliable time server

8 Automatic reliable time server, meaning the role is decided by Windows Time Service

The default is 10, meaning that Windows Time Service decides the role.

In the Group Policy settings located in Computer Configuration\Administrative Templates\System\Windows Time Service\Time Providers, there are a number of settings that might affect the way that Windows Time Service communicates across the Internet. The following table describes some of these policy settings.

Note

The table lists the settings that most directly affect the way Windows Time Service communicates with time sources, but the table does not list all settings. For example, it does not list the setting that specifies the location of the Windows Time Service DLL or the setting that controls event logging for Windows Time Service.

Selected Group Policy Settings for Configuring the Windows Time Service NTP Client for Computers Running Windows Vista

Setting Name and Effect

Default Setting

NtpServer: Establishes a space-delimited list of peers from which a computer obtains time stamps consisting of one or more DNS names or IP addresses per line. Computers connected to a domain must synchronize with a more reliable time source, such as the official U.S. time clock. This setting is used only when Type is set to NTP or AllSync.

0x01 SpecialInterval

0x02 UseAsFallbackOnly

0x04 SymmetricActive

0x08 NTP request in Client mode

time.windows.com, 0x1

Type: Indicates which peers to accept synchronization from as follows:

NoSync. Time service does not synchronize with other sources.

NTP. Time service synchronizes from the servers specified in the NtpServer registry entry.

NT5DS. Time service synchronizes from the domain hierarchy.

AllSync. Time service uses all the available synchronization mechanisms.

Workgroup: NTP

Domain: NT5DS

CrossSiteSyncFlags: Determines whether the service chooses synchronization partners outside the domain of the computer.

None 0

PdcOnly 1

All 2

This value is ignored if the NT5DS value is not set.

2

ResolvePeerBackoffMinutes: Specifies the initial interval to wait, in minutes, before attempting to locate a peer to synchronize with. If the Windows Time Service cannot successfully synchronize with a time source, it will keep retrying, using the settings specified in ResolvePeerBackoffMinutes and ResolvePeerBackoffMaxTimes.

15

ResolvePeerBackoffMaxTimes: Specifies the maximum number of times to double the wait interval when repeated attempts fail to locate a peer to synchronize with. A value of zero means that the wait interval is always the initial interval in ResolvePeerBackoffMinutes.

7

SpecialPollInterval: Specifies the special poll interval in seconds for peers that have been configured manually. When a special poll is enabled, Windows Time Service will use this poll interval instead of a dynamic one that is determined by synchronization algorithms built into Windows Time Service.

Procedures for Configuring Windows Time Service

The following procedures explain how to set some of the Windows Time Service configuration settings available in Group Policy. For details about other Group Policy settings for Windows Time Service, see the table earlier in this section.

To Set Group Policy for Windows Time Service Global Configuration Settings

In the details pane, double-click Enable Windows NTP Server, and then select Disabled.

Starting and Stopping Windows Time Service

By default, Windows Time Service starts automatically at system startup. You can, however, start or stop the service manually by accessing services in Administrative Tools or by using the net command.

To Manually Start or Stop Windows Time Service Using the Graphical Interface

Click Start, and then either click Control Panel, or point to Settings and then click Control Panel.

Click System and Maintenance and then click Administrative Tools, or double-click Administrative Tools.

Double-click Services.

Right-click Windows Time, and then click the action you want to perform—either Start or Stop.

To Manually Start or Stop Windows Time Service Using the net Command

To open a command prompt as an administrator, click Start, click All Programs, click Accessories, right-click Command Prompt, and click Run as administrator.

If the User Account Control dialog box appears, confirm that the action it displays is what you want, and then click Continue.

At the command prompt, type the appropriate command, and then press ENTER.

To start the service, type:

net start w32time

To stop the service, type:

net stop w32time

Synchronizing Computers with Time Sources

Use the following procedures to synchronize the internal time server with an external time source and to synchronize the client time with a time server.

To view the complete syntax for W32tm, at a command prompt, type:

w32tm /?

To Synchronize an Internal Time Server with an External Time Source

To open a command prompt as an administrator, click Start, click All Programs, click Accessories, right-click Command Prompt, and click Run as administrator.

If the User Account Control dialog box appears, confirm that the action it displays is what you want, and then click Continue.

At the command prompt, type the following (where PeerList is a comma-separated list of Domain Name System (DNS) names or Internet protocol (IP) addresses of the desired time sources):

w32tm /config /syncfromflags:manual /manualpeerlist:PeerList

and then press ENTER.

Type w32tm /config /update and then press ENTER.

Note

The most common use of this procedure is to synchronize the internal network's authoritative time source with a precise external time source. This procedure can be run on any computer running Windows 2000, Windows XP, Windows Server 2003, or Windows Vista. If the computer cannot reach the servers, the procedure fails and an entry is written to the Windows System event log.

The W32tm command-line tool is used for diagnosing problems that can occur with Windows Time Service. If you are going to use the tool on a domain controller, it is necessary to stop the service. Running the tool and Windows Time Service at the same time on a domain controller generates an error because both are attempting to use the same UDP port. When you finish using the W32tm command line tool, the service must be restarted.

To Synchronize the Client Time with a Time Server

To open a command prompt as an administrator, click Start, click All Programs, click Accessories, right-click Command Prompt, and click Run as administrator.

If the User Account Control dialog box appears, confirm that the action it displays is what you want, and then click Continue.

At the command prompt, type w32tm /resync, and then press ENTER.

Note

This procedure only works on computers that are joined to a domain.

Troubleshooting on a Computer that Is Unable to Synchronize with a Time Server

In many cases, problems with Windows Time Service can be attributed to network configuration. If the network is not configured correctly, computers might not be able to send time samples back and forth, and therefore will not be able to synchronize. Viewing the contents of NTP packets can help you identify exactly where a packet is blocked on a network. You can also use the W32tm command-line tool to assist you in troubleshooting this and other types of errors associated with Windows Time Service.

By default, a standalone workstation running Windows Time Service will not synchronize with a time source if the workstation’s time is more than 15 hours off. For information about scenarios in which this can occur, see “How Windows Time Service Can Affect Users and Applications,” earlier in this section.

To view the complete syntax for W32tm, at a command prompt, type:

w32tm /?

To Resynchronize the Client Time with a Time Server

To open a command prompt as an administrator, click Start, click All Programs, click Accessories, right-click Command Prompt, and click Run as administrator.

If the User Account Control dialog box appears, confirm that the action it displays is what you want, and then click Continue.

At the command prompt, type w32tm /resync /rediscover and then press ENTER.

Note

When you run the preceding command, it redetects the network configuration and rediscovers network resources, causing resynchronization. This rediscovery procedure only works on computers that are joined to a domain. You can then view the event log for more information about why the time service does not synchronize.

Additional References

For more information about configuring Windows Time Service during deployment of Windows Server 2003, see Designing and Deploying Directory and Security Services and Designing a Managed Environment in the Microsoft Windows Server 2003 Deployment Kit at: