Time Synchronization

As on-air broadcasting works with frame-by-frame accuracy and internal clock of server and client machines have significant time variance, they need regular synchronization with a single external source of exact time. A local NTP (Network Time Protocol) may be such a source: it's a server retrieving the exact time stamp from a GPS signal.

Scheme of Synchronization by NTP

Configuring NTP in Windows

Based on http://windowsnotes.ru.

Windows family operating systems contain the W32Time time service. The service is used for time synchronization within an organization. W32Time is responsible for work of both client and server parts of the time service: one computer may simultaneously work as a client and an NTP server.

By default, the Windows time service is configured in the following way:

When installing the OS, Windows launches the NTP client synchronized with an external time source;

When adding the computer into the domain, the type of synchronization changes. All client machines and workstations in the domain use the domain controller that checks their authenticity, for time synchronization;

If you promote a workstation to the domain controller, it launches an NTP server that uses a controller with the PDC emulator function as a time source.

The PDC emulator placed in the forest root domain works as a main time server for the whole organization; it is also synchronized with an external time source.

Generally, this scheme works properly and doesn't require any interference. However, the time service structure in Windows may not follow the domain hierarchy and any computer may become a reliable time source.

Configuring an NTP server in Windows Server 2008 R2 can be an example (NTP server in Windows 7 can be configured similarly).

NTP Server Launch

Time service in Windows Server doesn't have a graphic interface and is configured either from the command line or by direct editing of the system registry. Let's consider another way:

Open the registry branch in the “regedit” editor: HKLM\System\ CurrentControlSet\services\ W32Time\TimeProviders\ NtpServer.
To launch the NTP server, set “1” for the Enabled parameter. To apply changes, restart the time service by the net stop w32time && net start w32time command.

After the restart, the server is active and available to clients. This can be checked by the w32tm /query /configuration command: it shows the full list of service parameters. If the NTPServer section contains the “Enabled: 1” line, the time server works.

To make the NTP server available to clients, open the UDP port 123 in the firewall for incoming and outgoing traffic.

Basic Settings of NTP Server and Client

Registry branch	Parameter	Value
HKLM\System\ CurrentControlSet\services\ W32Time\Parameters	Type	NoSync – the NTP server doesn't synchronize with any external time source. The system clock built-in to the server CMOS chip is used (e.g., the clock may synchronize with the NMEA source by RS-232). NTP — the NTP server is synchronized with external time servers specified in the NtpServer registry parameter; NT5DS — the NTP server is synchronized according to the domain hierarchy; AllSync – the NTP server uses all available sources for synchronization. The default value for a computer within the domain is NT5DS (or NTP for a separately working computer).
HKLM\System\ CurrentControlSet\services\ W32Time\Parameters	NtpServer	In this parameter, specify NTP servers, with which the server will synchronize. By default, this parameter contains the Microsoft NTP server (time.windows.com, 0×1). If needed, add more NTP servers: enter their DNS names or IP addresses space-separated. At the end of every name, you can add a flag (e.g. 0×1) that defines the synchronization mode with a time server.\\The following values are possible: 0×1 – SpecialInterval, using the poll time interval; 0×2 – UseAsFallbackOnly mode; 0×4 – SymmetricActive, the symmetric active mode; 0×8 – Client, sending the request in the client mode.
HKLM\System\ CurrentControlSet\services\ W32Time\Config	AnnounceFlags	The parameter is responsible for the NTP server announcement. 0x0 (Not a time server) — the server does not announce itself via NetLogon as a time source: it can response to NTP requests, but neighbours will not be able to recognise it as a time source; 0x1 (Always time server) — the server will always announce itself, regardless of its status. 0x2 (Automatic time server) — the server will announce itself only if it receives reliable time from another neighbour (NTP or NT5DS); 0x4 (Always reliable time server) — the server will always announce itself as a reliable time source. To announce a workstation (not a domain controller) as a reliable time source, you need the 5th flag (1+4).
HKLM\System\ CurrentControlSet\services\ W32Time\TimeProviders\NtpClient	SpecialPollInterval	Setting the interval between updates in seconds; its default value is 604800 (one week), which is a lot, so it's better to reduce the value to a reasonable number – 1 hour (3600). This parameter may be relevant for client PCs as well.

After changing the settings, update the service configuration by the w32tm /config /update command.

List of Time Service Commands

The list of commands for configuring, monitoring and diagnosing the time service:

Command	Description
w32tm /monitor	The option allows finding out the difference between the system time of a given computer and the time at the domain controller or other computers. For example: w32tm /monitor /computers:time.nist.gov
w32tm /resync	The command can tell the computer to synchronize with the used time server.
w32tm /stripchart	The command shows the time difference between the current and remote computers. The w32tm /stripchart /computer:time.nist.gov /samples:5 /dataonly command can implement 5 comparisons with the indicated source and show the result as a text file.
w32tm /config	The basic command used to configure the NTP service; it allows setting the list of time servers used at the moment, the type of synchronization etc. For example, you may redefine default values and configure time synchronization with an external source by the w32tm /config /syncfromflags:manual /manualpeerlist:time.nist.gov /update command.
w32tm /query	Shows current settings of the service. For example, the w32tm /query /source command displays the current time source, and the w32tm /query /configuration command displays all parameters of the service.
net stop w32time	Stops the time service, if it is launched.
w32tm /unregister	Removes the time service from the computer.
w32tm /register	Registers the time service at the computer: the whole branch of parameters in the registry is created all over again.
net start w32time	Launches the service.

Troubleshooting

For Windows 7: the time service isn't launched automatically when Windows starts. Fixed in SP1 for Windows 7.