Click here to Skip to main content
15,884,099 members
Articles / Programming Languages / C++

How to Synchronise Your Windows 2000 Machine using SNTP

Rate me:
Please Sign up or sign in to vote.
4.74/5 (29 votes)
6 Jan 2004CPOL2 min read 96.6K   1.4K   29   5
Using the Windows 2000 Time Service to set the system clock

Introduction

I used to run Atomic clock to keep my system time accurate. But after the last rebuild of this computer, I didn't want to reinstall it. So I did a bit of poking around in MSDN and found the steps needed to let Windows 2000 synchronise itself to an internet time source using a service that's shipped as part of the operating system.

There's nothing earth-shattering in this little article - everything I present can be found in MSDN but I thought I'd write it up to save someone else the time needed to track it all down.

The primary source of information I used is the MicroSoft Knowledgebase article Q223184. (Clickety not provided because the URLs sometimes change).

Environment This Article Refers To

I've only tested this on Windows 2000 Professional, Service Pack 4.

Using the Windows 2000 Time Service

First, you need to modify the following registry keys (or download the registry script at the top of this article and merge it into your registry).

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters]
"LocalNTP"=dword:00000000
"Period"="SpecialSkew"
"NtpServer"="india.colorado.edu"
"NTP"="NTP"
"Type"="NTP"

The LocalNTP entry determines whether this machine, having been synchronised to an external source, will act as an NTP server for your local network.

The Period entry determines how often your machine synchronises to an external time source. SpecialSkew is the default value which occurs once every 45 minutes until 3 good synchronizations occur, then once every 8 hours (3 per day).

The NtpServer entry can be either an IP address or a URL. In either case, it should refer to a machine running the SNTP protocol. You'll see here that I'm using a server at what I presume is Colorado University. I got the server name by doing a search on Google looking for public SNTP servers. There are hundreds of such servers out there. As an aside, in general the providers of public servers request that each site synchronise only one or two machines via the external server and synchronise other machines at the site from those one or two externally synchronised machines.

You can also set the NtpServer entry from a command prompt by executing the following command:

net time /setsntp:india.colorado.edu

You can query the current NtpServer setting by executing this command:

net time /querysntp

which will display the current server name (or IP).

The Type entry is used to specify whether the time service synchronises to the domain controller, to an external source, or doesn't synchronise at all.

Once you've set the registry entries, you need to set the time service to run automatically upon boot. The service is called Windows Time in the services applet. On Windows 2000 Professional systems, the service is installed but set to manual start. Set your clock to some wildly wrong value, start the service and the clock should change to indicate the machine is now synchronised to the external time source you specified.

That's It

I hope this little article comes in useful for someone out there.

History

  • January 7, 2004 - Initial version

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
I've been programming for 35 years - started in machine language on the National Semiconductor SC/MP chip, moved via the 8080 to the Z80 - graduated through HP Rocky Mountain Basic and HPL - then to C and C++ and now C#.

I used (30 or so years ago when I worked for Hewlett Packard) to repair HP Oscilloscopes and Spectrum Analysers - for a while there I was the one repairing DC to daylight SpecAns in the Asia Pacific area.

Afterward I was the fourth team member added to the Australia Post EPOS project at Unisys Australia. We grew to become an A$400 million project. I wrote a few device drivers for the project under Microsoft OS/2 v 1.3 - did hardware qualification and was part of the rollout team dealing directly with the customer.

Born and bred in Melbourne Australia, now living in Scottsdale Arizona USA, became a US Citizen on September 29th, 2006.

I work for a medical insurance broker, learning how to create ASP.NET websites in VB.Net and C#. It's all good.

Oh, I'm also a Kentucky Colonel. http://www.kycolonels.org

Comments and Discussions

 
GeneralThanks! Pin
Anonymous1-Oct-04 6:39
Anonymous1-Oct-04 6:39 
GeneralSync SNTP time once only Pin
mcpata200220-Jun-04 17:12
mcpata200220-Jun-04 17:12 
GeneralWin 2000 time Pin
Gordon Moore14-Jan-04 6:21
Gordon Moore14-Jan-04 6:21 
GeneralRe: Win 2000 time Pin
Rob Manderson19-Jan-04 23:07
protectorRob Manderson19-Jan-04 23:07 
Generalgood find Pin
Vadim Tabakman7-Jan-04 12:26
Vadim Tabakman7-Jan-04 12:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.