1181834Sroberto<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2181834Sroberto
3181834Sroberto<html>
4181834Sroberto
5181834Sroberto    <head>
6181834Sroberto        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
7181834Sroberto        <title>NTP on Windows NT</title>
8181834Sroberto        <link href="scripts/style.css" type="text/css" rel="stylesheet">
9181834Sroberto    </head>
10181834Sroberto
11181834Sroberto    <body>
12181834Sroberto        <h1>NTP 4.x for Windows NT</h1>
13181834Sroberto
14181834Sroberto        <h2>Introduction</h2>
15181834Sroberto        The NTP 4 distribution runs as service on Windows NT 4.0, Windows 2000, Windows XP,
16181834Sroberto        Windows .NET Server 2003. It will NOT run on Windows 95, 98, ME, etc.
17181834Sroberto        The binaries work on multi-processor systems. This port has not been tested
18181834Sroberto        on the Alpha platform. This release now uses OpenSSL for authentication.
19181834Sroberto        IPv6 is not implemented yet for Win32 platforms.
20181834Sroberto        <h2>Authentication Keys</h2>
21181834Sroberto        With this release ntp-keygen is supported. See the <a href="../../keygen.html">
22181834Sroberto        ntp keygen documentation</a> for details on how to use ntp-keygen.
23181834Sroberto        <p>
24181834Sroberto        ntpd can now use the generated keys in the same way as on Unix platforms. Please
25181834Sroberto        refer to the <a href="../../authopt.html">Authentication Options</a> for details
26181834Sroberto        on how to use these.
27181834Sroberto        <p><B>NOTE:</B> ntpd and ntp-keygen both use OpenSSL which requires a random
28181834Sroberto        character file called .rnd by default. Both of these programs will automatically
29181834Sroberto        generate this file if they are not found. The programs will look for an
30181834Sroberto        environmental variable called RANDFILE and use that for the name of the
31181834Sroberto        random character file if the variable exists. If it does not exist it will look for an environmental
32181834Sroberto        variable called HOME and use that directory to search for a filed called .rnd
33181834Sroberto        in that directory. Finally, if neither RANDFILE nor HOME exists it will look
34181834Sroberto        in C:\ for a .rnd file. In each case it will search for and create the file
35181834Sroberto        if the environmental variable exists or in the C:\ directory if it doesn't.
36181834Sroberto        Note that ntpd normally runs as a service so that the only way that it will
37181834Sroberto        have either RANDFILE or HOME defined is if it is a System environmental
38181834Sroberto        variable or if the service is run under a specific account name and that
39181834Sroberto        account has one of those variables defined. Otherwise it will use the file
40181834Sroberto        "c:\.rnd". This was done so that OpenSSL will work normally on Win32 systems.
41181834Sroberto        This obviates the need to ship the OpenSSL.exe file and explain how to
42181834Sroberto        generate the .rnd file. A future version may change this behavior.
43181834Sroberto
44181834Sroberto        <p>Refer to <a href="#Compiling">Compiling Requirements</a> and Instructions for how to compile the program.</p>
45181834Sroberto        <h2>Reference Clocks</h2>
46181834Sroberto        Reference clock support under Windows NT is tricky because the IO functions are
47181834Sroberto        so much different. Some of the clock types have been built into the ntpd executable
48181834Sroberto        and should work but have not been tested by the ntp project. If you have a clock
49181834Sroberto        that runs on Win32 and the driver is there but not implemented on Win32 you will have
50181834Sroberto        make the required configuration changes in config.h and then build ntpd from source
51181834Sroberto        and test it. The following reference clocks are known to work and are supported
52181834Sroberto        by Windows NT:
53181834Sroberto        <p><a href="../../driver1.html">Type 1</a> Undisciplined Local Clock (LOCAL)<br>
54181834Sroberto            <a href="../../driver29.html">Type 29</a> Trimble Navigation Palisade GPS (GPS_PALISADE)</p>
55181834Sroberto        <h2>Functions Supported</h2>
56181834Sroberto        All NTP functions are supported with some constraints. See the <a href="#ToDo">TODO list</a> below.
57181834Sroberto        Note that the ntptrace executable is not supported and you should use the PERL script
58181834Sroberto        version instead.
59181834Sroberto        <h2>Accuracy</h2>
60181834Sroberto        Greg Brackley has implemented a fantastic interpolation scheme that improves the precision of the NTP clock
61181834Sroberto        using a realtime thread (is that poetic or what!) which captures a tick count from the 8253 counter after each
62181834Sroberto        OS tick. The count is used to interpolate the time between operating system ticks.
63181834Sroberto        <p>On a typical 200+ MHz system NTP achieves a precision of about 5 microseconds and synchronizes the clock 
64181834Sroberto        to +/-500 microseconds using the <a href="http://www.trimble.com/products/ntp">Trimble Palisade</a> as UTC reference.
65181834Sroberto        This allows distributed applications to use the 10 milliseconds ticks available to them with high confidence.</p>
66181834Sroberto        <h2>Binaries</h2>
67181834Sroberto        Recent InstallShield based executable versions of NTP for Windows NT (intel) are available from:
68181834Sroberto        <ul>
69181834Sroberto        <li><a href="http://www.trimble.com/oem/ntp">http://www.trimble.com/oem/ntp</a>
70181834Sroberto        <li><a href="http://www.five-ten-sg.com/">http://www.five-ten-sg.com/</a>
71181834Sroberto        <li><a href="http://www.meinberg.de/english/sw/ntp.htm">http://www.meinberg.de/english/sw/ntp.htm</a>
72181834Sroberto        </ul>
73181834Sroberto        <a name="ToDo"><h2>ToDo</h2></a>
74181834Sroberto        These tasks are in no particular order of priority.
75181834Sroberto        <ul>
76181834Sroberto            <li>Create a proper install/uninstall program
77181834Sroberto            <li>Add sntp to the list of supported programs
78181834Sroberto            <li>Add support for Visual C++ 7.0 or later (.NET)
79181834Sroberto            <li>Add IPv6 support
80181834Sroberto            <li>See if precision can be improved by using CPU cycle counter for tick interpolation.
81181834Sroberto            <li>Make precision time available to applications using NTP_GETTIME API
82181834Sroberto        </ul>
83181834Sroberto        <h2>Compiling Requirements</h2>
84181834Sroberto        <ul>
85181834Sroberto            <li>Windows NT 4.0 Windows 2000, Windows XP, or Windows.NET Server 2003
86181834Sroberto            <li>Microsoft Visual C++ 6.0. <B>NOTE:</B> VC++ 7.0 (aka .NET) is not yet supported
87181834Sroberto            but will probably work fine.
88181834Sroberto            <li>Some way of uncompressing and untarring the gzipped tar file.
89181834Sroberto            <li>OpenSSL must be built on the box before building NTP. Additional steps would
90181834Sroberto            be required to not use OpenSSL.
91181834Sroberto        </ul>
92181834Sroberto        <a name="Compiling"><h2>Compiling Instructions</h2></a>
93181834Sroberto        <ol>
94181834Sroberto            <li>Unpack and build OpenSSL according to the OpenSSL instructions for building on
95181834Sroberto            Windows. An environment variable named OPENSSL must be set up to specify the base path 
96181834Sroberto            of the OpenSSL directory to be used to build the NTP package
97181834Sroberto            (e.g. <code>OPENSSL=C:\openssl-0.9.8b</code>).
98181834Sroberto            <li>Unpack the ntp-*.tar.gz archive using utilities such as WinZip.
99181834Sroberto            <li>Open the .\ports\winnt\ntp.dsw Visual C workspace
100181834Sroberto            <li>Batch build all projects
101181834Sroberto            <li>The built binaries can be found in the port\winnt\bin\Release subdirectory
102181834Sroberto            <li>In addition you will need to install the OpenSSL libeay32.dll
103181834Sroberto            <li>If you are shipping binaries in a kit it is strongly recommended that you
104181834Sroberto            ship this file (winnt.html) along with the binaries.
105181834Sroberto        </ol>
106181834Sroberto        <h2>Configuration File</h2>
107181834Sroberto        The default NTP configuration file path is %SystemRoot%<tt>\system32\drivers\etc\. </tt>(%SystemRoot% 
108181834Sroberto        is an environmental variable that can be determined by typing &quot;set&quot; at the &quot;Command Prompt&quot; 
109181834Sroberto        or from the &quot;System&quot; icon in the &quot;Control Panel&quot;).<br>
110181834Sroberto        Refer to your system environment and <tt>c</tt>reate your<tt> ntp.conf</tt> file in the directory 
111181834Sroberto        corresponding to your system&nbsp; installation.<br>
112181834Sroberto        <tt>The older &lt;WINDIR&gt;\ntp.conf </tt>is still supported but you will get a log entry reporting that 
113181834Sroberto        the first file wasn't found.
114181834Sroberto        <h2>Installation Instructions</h2>
115181834Sroberto        The <tt>instsrv</tt> program in the instsrv subdirectory of the distribution can be used to install 'ntpd' as 
116181834Sroberto        a service and start automatically at boot time. Instsrv is automatically compiled with the rest of the distribution
117181834Sroberto        if you followed the steps above.
118181834Sroberto        <ol>
119181834Sroberto            <li>Start a command prompt and enter &quot;instsrv.exe &lt;pathname_for_ntpd.exe&gt;&quot;
120181834Sroberto            <li>Clicking on the &quot;Services&quot; icon in the &quot;Control Panel&quot; will display the list of 
121181834Sroberto            currently installed services in a dialog box. The NetworkTimeProtocol service should show up in this list.
122181834Sroberto            Select it in the list and hit the &quot;Start&quot; button in the dialog box. The NTP service should start.
123181834Sroberto            <li>You can also stop and start the service by typing net start|stop NetworkTimeProtocol at the DOS prompt.
124181834Sroberto            <li>View the event log by clicking on the &quot;Event Viewer&quot; icon in the &quot;Administrative Tools&quot; 
125181834Sroberto            group, there should be several successful startup messages from NTP. NTP will keep running and restart 
126181834Sroberto            automatically when the machine is rebooted.
127181834Sroberto        </ol>
128181834Sroberto        You can change the start mode (automatic/manual) and other startup parameters corresponding to the NTP service 
129181834Sroberto        in the &quot;Services&quot; dialog box if you wish.
130181834Sroberto        <h2>Removing NTP</h2>
131181834Sroberto        You can also use <tt>instsrv</tt> to delete the NTP service by entering: &quot;instsrv.exe remove&quot;
132181834Sroberto        <h2>Command Line Parameters and Registry Entries</h2>
133181834Sroberto        Unlike the Unix environment, there is no clean way to run 'ntpdate' and reset the clock before starting 'ntpd' at boot time.<br>
134181834Sroberto        NTP will step the clock up to 1000 seconds by default. While there is no reason that the system clock should be that much off 
135181834Sroberto        during bootup if 'ntpd' was running before, you may wish to override this default and/or pass other command line directives.
136181834Sroberto        <p>Use the registry editor to edit the value for the ntpd executable under LocalMachine\System\CurrentControlSet\Services\NTP.</p>
137181834Sroberto        <p>Add the -g option to the ImagePath key, behind &quot;%INSTALLDIR&gt;\ntpd.exe&quot;. This will force NTP to accept 
138181834Sroberto        large time errors (including 1.1.1980 00:00)</p>
139181834Sroberto        <h2>Bug Reports</h2>
140181834Sroberto        Send questions to <a href="news://comp.protocols.time.ntp">news://comp.protocols.time.ntp</a>
141181834Sroberto        and bug reports should be entered in <a href="http://bugzilla.ntp.org/">Bugzilla</a> on the
142181834Sroberto        NTP Web site.
143181834Sroberto        <h2>Change Log</h2>
144181834Sroberto        <h3>Last revision 2 July 2003&nbsp; Version 4.2.0</h3>
145181834Sroberto        <b>by Danny Mayer (mayer@ntp.org>)</b>
146181834Sroberto        <h3>Significant Changes:</h3>
147181834Sroberto        This latest release of NTP constitutes a major upgrade to its ability to build and
148181834Sroberto        run on Windows platforms and should now build and run cleanly. More importantly it
149181834Sroberto        is now able to support all authentication in the same way as Unix boxes. This does
150181834Sroberto        require the usage of OpenSSL which is now a prerequisite for build on Windows.
151181834Sroberto        ntp-keygen is now supported and builds on Win32 platforms.
152181834Sroberto
153181834Sroberto        <h3>Last revision 16 February 1999&nbsp; Version 4.0.99e.</h3>
154181834Sroberto        <b>by Sven Dietrich (sven_dietrich@trimble.com)</b>
155181834Sroberto        <p><b>Significant Changes:</b></p>
156181834Sroberto        <ul>
157181834Sroberto            <li>Perl 5 is no longer needed to compile NTP. The configuration script which creates version.c 
158181834Sroberto            with the current date and time was modified by Frederick Czajka [w2k@austin.rr.com] so that Perl
159181834Sroberto            is no longer required.
160181834Sroberto        </ul>
161181834Sroberto        <h3>Last revision 15 November 1999&nbsp; Version 4.0.98f.</h3>
162181834Sroberto        <b>by Sven Dietrich (sven_dietrich@trimble.com)</b>
163181834Sroberto        <p><b>Significant Changes:</b></p>
164181834Sroberto        <ul>
165181834Sroberto            <li>Fixed I/O problem delaying packet responses which resulted in no-replys to NTPQ and others.
166181834Sroberto            <li>The default configuration file path is <tt>&lt;WINDIR&gt;\system32\drivers\etc\ntp.conf. 
167181834Sroberto            The old &lt;WINDIR&gt;\ntp.conf </tt>is still supported but you will get a log entry reporting 
168181834Sroberto            that the first file wasn't found. The NTP 3.x legacy <tt>ntp.ini</tt> file is no longer supported.
169181834Sroberto        </ul>
170181834Sroberto        <b>Known Problems / TODO:</b>
171181834Sroberto        <ul>
172181834Sroberto            <li>MD5 and name resolution do not yet get along. If you define MD5, you cannot use DNS names, only IP numbers.
173181834Sroberto        </ul>
174181834Sroberto        <h3>Last revision 27 July 1999&nbsp; Version 4.0.95.</h3>
175181834Sroberto        This version compiles under WINNT with Visual C 6.0.
176181834Sroberto        <p>Greg Brackley and Sven Dietrich</p>
177181834Sroberto        <p>Significant changes:<br>
178181834Sroberto            -Visual Studio v6.0 support<br>
179181834Sroberto            -Winsock 2.0 support<br>
180181834Sroberto            -Use of I/O completion ports for sockets and comm port I/O<br>
181181834Sroberto            -Removed the use of multimedia timers (from ntpd, others need removing)<br>
182181834Sroberto            -Use of waitable timers (with user mode APC) and performance counters to fake getting a better time<br>
183181834Sroberto            -Trimble Palisade NTP Reference Clock support<br>
184181834Sroberto            -General cleanup, prototyping of functions<br>
185181834Sroberto            -Moved receiver buffer code to a separate module (removed unused members from the recvbuff struct)<br>
186181834Sroberto            -Moved io signal code to a separate module</p>
187181834Sroberto        <h3>Last revision:&nbsp; 20-Oct-1996</h3>
188181834Sroberto        This version corrects problems with building the XNTP<br>
189181834Sroberto        version 3.5-86 distribution under Windows NT.
190181834Sroberto        <p>The following files were modified:<br>
191181834Sroberto            &nbsp;blddbg.bat<br>
192181834Sroberto            &nbsp;bldrel.bat<br>
193181834Sroberto            &nbsp;include\ntp_machine.h<br>
194181834Sroberto            &nbsp;xntpd\ntp_unixclock.c<br>
195181834Sroberto            &nbsp;xntpd\ntp_refclock.c<br>
196181834Sroberto            &nbsp;scripts\wininstall\build.bat<br>
197181834Sroberto            &nbsp;scripts\wininstall\setup.rul<br>
198181834Sroberto            &nbsp;scripts\wininstall\readme.nt<br>
199181834Sroberto            &nbsp;scripts\wininstall\distrib\ntpog.wri<br>
200181834Sroberto            &nbsp;html\hints\winnt (this file)</p>
201181834Sroberto        <p>In order to build the entire Windows NT distribution you<br>
202181834Sroberto            need to modify the file scripts\wininstall\build.bat<br>
203181834Sroberto            with the installation directory of the InstallShield<br>
204181834Sroberto            software.&nbsp; Then, simply type &quot;bldrel&quot; for non-debug<br>
205181834Sroberto            or &quot;blddbg&quot; for debug executables.</p>
206181834Sroberto        <p>Greg Schueman<br>
207181834Sroberto            &nbsp;&nbsp;&nbsp; &lt;schueman@acm.org&gt;</p>
208181834Sroberto        <h3>Last revision:&nbsp; 07-May-1996</h3>
209181834Sroberto        This set of changes fixes all known bugs, and it includes<br>
210181834Sroberto        several major enhancements.
211181834Sroberto        <p>Many changes have been made both to the build environment as<br>
212181834Sroberto            well as the code.&nbsp; There is no longer an ntp.mak file, instead<br>
213181834Sroberto            there is a buildntall.bat file that will build the entire<br>
214181834Sroberto            release in one shot.&nbsp; The batch file requires Perl.&nbsp; Perl<br>
215181834Sroberto            is easily available from the NT Resource Kit or on the Net.</p>
216181834Sroberto        <p>The multiple interface support was adapted from Larry Kahn's<br>
217181834Sroberto            work on the BIND NT port.&nbsp; I have not been able to test it<br>
218181834Sroberto            adequately as I only have NT servers with one network<br>
219181834Sroberto            interfaces on which to test.</p>
220181834Sroberto        <p>Enhancements:<br>
221181834Sroberto            * Event Logging now works correctly.<br>
222181834Sroberto            * Version numbers now work (requires Perl during build)<br>
223181834Sroberto            * Support for multiple network interface cards (untested)<br>
224181834Sroberto            * NTP.CONF now default, but supports ntp.ini if not found<br>
225181834Sroberto            * Installation procedure automated.<br>
226181834Sroberto            * All paths now allow environment variables such as %windir%</p>
227181834Sroberto        <p>Bug fixes:<br>
228181834Sroberto            * INSTSRV replaced, works correctly<br>
229181834Sroberto            * Cleaned up many warnings<br>
230181834Sroberto            * Corrected use of an uninitialized variable in XNTPD<br>
231181834Sroberto            * Fixed ntpdate -b option<br>
232181834Sroberto            * Fixed ntpdate to accept names as well as IP addresses<br>
233181834Sroberto            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Winsock WSAStartup was called after a gethostbyname())<br>
234181834Sroberto            * Fixed problem with &quot;longjmp&quot; in xntpdc/ntpdc.c that<br>
235181834Sroberto            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; caused a software exception on doing a Control-C in xntpdc.<br>
236181834Sroberto            &nbsp;A Cntrl-C now terminates the program.</p>
237181834Sroberto        <p>See below for more detail:</p>
238181834Sroberto        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Note: SIGINT is not supported for any Win32 application including<br>
239181834Sroberto            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Windows NT and Windows 95. When a CTRL+C interrupt occurs, Win32<br>
240181834Sroberto            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; operating systems generate a new thread to specifically handle that<br>
241181834Sroberto            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; interrupt. This can cause a single-thread application such as UNIX,<br>
242181834Sroberto            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; to become multithreaded, resulting in unexpected behavior.<br>
243181834Sroberto            &nbsp;</p>
244181834Sroberto        <p>Possible enhancements and things left to do:<br>
245181834Sroberto            * Reference clock drivers for NT (at least Local Clock support)<br>
246181834Sroberto            * Control Panel Applet<br>
247181834Sroberto            * InstallShield based installation, like NT BIND has<br>
248181834Sroberto            * Integration with NT Performance Monitor<br>
249181834Sroberto            * SNMP integration<br>
250181834Sroberto            * Fully test multiple interface support<br>
251181834Sroberto            &nbsp;</p>
252181834Sroberto        <p>Known problems:<br>
253181834Sroberto            *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bug in ntptrace - if no Stratum 1 servers are available,<br>
254181834Sroberto            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; such as on an 
255181834Sroberto            IntraNet, the application crashes.</p>
256181834Sroberto        <h3>Last revision:&nbsp; 12-Apr-1995</h3>
257181834Sroberto        This NTPv3 distribution includes a sample configuration file and the project<br>
258181834Sroberto        makefiles for WindowsNT 3.5 platform using Microsoft Visual C++ 2.0 compiler.<br>
259181834Sroberto        Also included is a small routine to install the NTP daemon as a &quot;service&quot;<br>
260181834Sroberto        on a WindowsNT box. Besides xntpd, the utilities that have been ported are<br>
261181834Sroberto        ntpdate and xntpdc. The port to WindowsNT 3.5 has been tested using a Bancomm<br>
262181834Sroberto        TimeServe2000 GPS receiver clock that acts as a strata 1 NTP server with no<br>
263181834Sroberto        authentication (it has not been tested with any refclock drivers compiled in).<br>
264181834Sroberto        Following are the known flaws in this port:<br>
265181834Sroberto        1) currently, I do not know of a way in NT to get information about multiple<br>
266181834Sroberto        &nbsp;&nbsp; network interface cards. The current port uses just one socket bound to<br>
267181834Sroberto        &nbsp;&nbsp; INADDR_ANY address. Therefore when dealing with a multihomed NT time server,<br>
268181834Sroberto        &nbsp;&nbsp; clients should point to the default address on the server (otherwise the<br>
269181834Sroberto        &nbsp;&nbsp; reply is not guaranteed to come from the same interface to which the<br>
270181834Sroberto        &nbsp;&nbsp; request was sent). Working with Microsoft to get this resolved.<br>
271181834Sroberto        2) There is some problem with &quot;longjmp&quot; in xntpdc/ntpdc.c that causes a<br>
272181834Sroberto        &nbsp;&nbsp; software exception on doing a Control-C in xntpdc. Be patient!<br>
273181834Sroberto        3) The error messages logged by xntpd currently contain only the numerical<br>
274181834Sroberto        &nbsp;&nbsp; error code. Corresponding error message string has to be looked up in<br>
275181834Sroberto        &nbsp;&nbsp; &quot;Books Online&quot; on Visual C++ 2.0 under the topic &quot;Numerical List of Error<br>
276181834Sroberto        &nbsp;&nbsp; Codes&quot;.
277181834Sroberto        <p>Last HTML Update: November 17, 1999<br>
278181834Sroberto            <a href="mailto://sven_dietrich@trimble.com">Sven_Dietrich@Trimble.COM</a></p>
279181834Sroberto    </body>
280181834Sroberto
281181834Sroberto</html>
282