NTPTime Client NTPTime is a Network Time Protocol client program used to accurately set your computer's time from the internet. It runs on Windows NT or Windows 95. It can operate with a dial-up network connection or a direct internet link. Both the executable and the source code are freely available.
This document and the NTPTime program and source code are all Copyright © Tom Horsley, 1997, 1998. All rights reserved. The right to unlimited distribution and use of this program is granted to anyone who agrees to keep the copyright notice intact and not alter the program. Translation: You want changes in the program, make 'em yourself, but don't go distributing that changed version with my name on it (or with your name on it either, since you didn't write most of it :-). If there are changes you would like to see distributed, by all means send 'em in to me, and if I like 'em I'll incorporate them in the next version. NTPTime is an NTP client program. This means that it uses the internet to set the time on your computer by talking to a system somewhere out in the world which is running an NTP time server. There are many such servers available on the internet, and the installation section will describe how to find one. NTPTime runs as a service on Windows NT which must be installed by a user with administrator privileges (I have only tested it on 4.0, but it may run fine under any version of NT). On Windows 95 it runs as hidden window, and you will probably want to add it to your start menu. If you connect to the internet via dial up networking, NTPTime can be configured to lurk in the background until it notices you have an active internet connection, then talk to the server to set the time. This lurking (after much blood sweat and tears) will never trigger an autodial on your computer (I hope - Microsoft seems to keep "helpfully" making more and more events trigger autodialing). Instead, it waits for you to connect for some other reason, then asks for the time. If you want it to autodial, I recommend calling rasdial from your startup menu to initiate a connection as soon as you log in. If you have a direct internet connection, all this can be turned off and it will just assume it can get to the NTP server anytime it wants to. If you don't like the idea of a background process cluttering up your system all the time, then you can configure it to set the time only once, then exit. This way it only clutters up your system until the first time you connect to the internet. NTPTime can keep a log file showing when it adjusted the clock and how much it adjusted it by. This log will also record any errors which make the program exit, so the log is valuable if you are having trouble getting it to work. I haven't written a fancy installer for NTPTime, so you're going to have to do the install manually. This will involve copying the program where it should live and using the registry editor to install a new key and the values under that key which configure how NTPTime operates. On Windows NT you will also need to run the program once with a special option to register it as a service and you will need to be the administrator or at least have administrator privileges. In anticipation of possible future versions, I should mention that the first thing you should do is uninstall any existing version before installing a new one (the uninstall directions are below). Now copy the If you are running on Windows NT, you now need to You now need to decide which NTP server you are going to talk to and what configuration options you want to use with NTPTime. The most interesting decision may be the time server. I don't have any defaults built in, because I don't want to cause any grief for particular well known time servers by listing them here. You should go through a two step process to find the best server to use. First contact your ISP or the administrators of any corporate network you may be attached to and find out if they are already running an NTP server. If they are, then that's the one you'll want to use, because it is sure to be closer to your machine than the internet at large. If there is no local NTP server available to use, then you'll have to
consult the NTP Home Page for
pointers to publicly available NTP servers. There is no reason, given the
accuracy of this program and PC clocks in general to talk to the most
accurate "stratum 1" servers. Use one of the "stratum 2" or below
servers. Pick one which has low ping times or which For both Windows 95 and Windows NT, you now need to run the registry
editor and install the new key and values under that key which determine how
NTPTime will behave on your system. In case you aren't familiar with the
registry editor, it is called The key you need to create is:
The The Now you need to create the following mandatory values under that key (if you don't define all of these values, NTPTime will probably barf as soon as it tries to run).
There are also some optional values you can set:
If you are on Windows 95, you are now done. You can add an entry to your startup menu to run NTPTime when you login, or you can just run it manually when you feel the need to set the time. Note that no window or icon will show up for NTPTime when it is running, but it will appear in the task list you get when you Ctrl-Alt-Delete, and you can end the task from there. If you are on Windows NT, there is one more step to take. You need to go to the control panel and double click on "Services" to bring up the service manager. Click on the NTPTime service to select it, and press the Start button. This should start the service running, and it will automatically start from now on when you boot the system. Because it will be running as administrator, it can set the time even if a non-administrator user is the one who logs on to the internet. If you decide to change any registry entries, you will need to stop, then restart the service before it notices any of the changes. To remove NTPTime, you basically just reverse the install process. On Windows NT, you need to go to the services manager (from the control
panel) and stop the service. Then you can run
If you don't want your registry cluttered up, you can remove the
Then just delete the program, and it is gone forever. If you had logging turned on, you might also want to remove the log directory. And if you installed this html file somewhere you could remove it too. The current version of NTPTime is 2.3. NTPTime was built with Microsoft Visual C++ 5.0 on Windows NT 4.0. It has been tested under Windows 95. All of this has only been tested on the x86 architecture (the only flavor machine I have).
If anyone wants to build and host executables for other architectures, I will gladly provide pointers from here, but I don't have enough space that I'd want to host them myself. The To build with Visual C++, you can just type The default library list that VC++ generates is not correct, to link successfully, you will need to change the project settings to use the following set of libraries:
Some of the default libraries were removed from this list because they are not used. NOTE: This program has not been extensively tested (especially under Windows 95). It basically has one user (me) and has only talked to one server. I have gotten some feedback from previous versions, and at least some people seem to be happy with it (which was nice to hear about :-). I do run this on my Windows NT 4.0 system at home, and it hasn't caused any problems since the one where it would hang the service control manager :-). But remember, this is free software, it has only as much support as I feel like providing, and it is relatively new (or was in May of 1997 when version 2.1 was publicly released for the first time). User beware. On the other hand if you really want something fixed, the source is available too, so you can always fix it yourself. Yes, there is a program named To set the time, NTPTime needs to talk to an NTP server using the TCP/IP UDP protocol. Many firewalls won't relay UDP packets, so if you are behind a firewall, your best bet is to convince the powers that be to run an NTP server on the firewall, then you can talk to that. NTPTime uses the win32 Some governments seem to be constantly fiddling with the daylight savings
time standards for their country. As a result, windows may not be able to
set the correct timezone for your computer. Microsoft has a utility program
available on their web site for editing timezone and daylight time parameters.
You can look for
http://www.microsoft.com/windows/download/tze.exe
if it is still in the last place I found it, or you might simply go to
http://www.microsoft.com/
and use their search feature to look for If you are running this, and also running some kind of high overhead game that hogs every resource it can get, I make no promises about any interference this might cause with games. Best bet is not to run it at the same time you are playing a game. On Windows NT, the On Windows 95 and 98, NTPTime runs as a completely hidden windows program. If you don't see anything happen when you start it up, that's perfectly normal. The only sign that it is running will be the log file entries it creates (if you configured the registry to write log files), and the entry that will show up for it in the task list you get when you type Ctrl-Alt-Delete. You can use the task list to select NTPTime and do an "End Task" if you need to shut it down (which is slightly less drastic than rebooting the computer to shut it down :-). Some useful resources for NTP information are:
You can reach me with feedback at Tom.Horsley@worldnet.att.net. Bug reports should mention stuff like which operating system you are running on, which version of NTPTime you are using (you might want to check this web page to see if there is a newer version which might already fix your problem before reporting it). If the bug is unexpected termination of the program, then including the log file showing any messages it might have recorded will be a help (if you have logging turned off, I doubt I'll be able to guess what went wrong from zero data, try turning logging on and wait and see if it happens again). Enhancement requests are also welcome, most especially ones which come with source code patches to implement the enhancement (which is one of the reasons I make the source available). Just remember, I do this for learning and fun, not to make a profit, so don't expect lightning quick response. I only have a limited amount of free time to kill fooling with this program (but at least I can keep track of it very accurately now). Any fury or flames about this program should be directed at the fool who decided to run an unsupported free program on his or her computer, not at me :-). Why does the world need another NTP client? It doesn't really, I just wanted to learn about writing Windows NT services, and I wanted the service I wrote to be something "real" rather than one of the dummy samples you often see in Microsoft's documentation. I also thought NTP was interesting, so I chose that as my project. In addition to learning about services, I also took this opportunity to use exceptions and some of the other new C++ features. That turned out to be fun as well, and I learned a lot about how to make using exceptions a safe thing to do when you also need to worry about releasing critical sections, freeing up sockets, etc. So, if yet another NTP client offends you, I apologize, but I found it a useful project, and as long as I had it, it seemed a shame not to clean it up a bit and make it available for anyone else who wants it. If I ever decide to learn all about control panel apps or writing install programs, then this tool may become easier to administer or install :-). Finally, the real subversive motive behind this program is using the free software I write as bait to lure unsuspecting people to my home page, where they can read about the political ideas that will revolutionize governing for generations to come! They will then write their congresscritters about it. The congresscritters will steal the ideas so they can take the credit, and pretty soon the whole country will be running with my ideas :-). The initial release of NTPTime was version 2.1. Version 2.2 was an internal version I never fully released. It didn't do much other than some improved (or different, anyway) error logging and making the NT service dependencies be a little smarter about RAS. Version 2.3 is the new public version. It doesn't yet have major
improvements (i.e. no setup program :-), but at least (I hope), you no
longer need to have RAS installed on your machine in order to run
NTPTime. It now only loads the |