tags:

views:

40

answers:

1

I have a client/server application for which it is beneficial to have the PC clocks on the client and server synchronized. I want my setup program to offer an option to configure the W32Time service automatically.

I have found sufficient documentation to configure the service's registry entries (principally here), and I have confirmed that after restarting the service, the clock on my test client PC is corrected to match the clock on my test server PC. However, if I look at the Date and Time control panel on the client PC, it still indicates that the clock is set to be synchronized to time.windows.com (the default) instead of the test server PC.

How can I trigger the Date and Time control panel to update itself to match the time service configuration? Or failing that, where can I find the control panel's configuration stash and update it myself?

A: 

Digging around in the registry, I have found an answer. The Date and Time control panel stores a list of time servers under its own registry location:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers

Regardless of the actual configuration of W32Time, the control panel will use this information when showing its UI. Each value under the key has a numeric name and is of type REG_SZ containing the hostname of a time server. The (Default) value is the number of the currently-selected server in the control panel.

Therefore, I needed to add a new string value for my time server and set its number in the (Default) value.

Matthew Xavier