                 NTP Monitor - A network clock monitor

This program compares a number of network clocks to local time using the 
NTP, TIME or certain versions of the DAYTIME protocol.  Results are 
presented graphically and textually.  No claims are made for accuracy, it 
provides a simple check on the functioning of network time.  The NTP
Monitor's home page is here:

  http://www.satsignal.eu/software/net.htm#NTPmonitor


REGISTRATION

No registration is required for purely amateur use of the program.  
Should you want to say "thanks", or to use the program for commercial or 
profit-making purposes, or you want technical support from me, please 
purchase one or more support licences from:

  http://www.satsignal.eu/software/reg-network-tools.html


OPERATION

Nominated time server nodes are monitored at 60-second intervals, and their
offset from local PC time and other data is presented.  The data often
includes the local time the request left your PC, the time it arrived at the 
server, and the time the server responded.  You can also see at what stratum 
the server is operating, when it was last synchronised and by whom and so on.
At the end of each 60 scan, the current offsets are written to a file 
offsets.dat in the program's folder.

All network times are compared to the rather inaccurate PC clock, and the
difference displayed in the form of a clock.  If NTP is not available from a 
server, the simpler, but less accurate, TIME or DAYTIME protocols are tried.
As these times may not be UTC, there may be a large fixed offset according to
your time zone.

The offset is shown as a slider bar (the simplest graphic I could think of to 
do this) which has a scale of -1 sec to +1 sec.  Correct operation will show 
the adjuster of the slider at dead centre.  The tick marks are at 0.1 sec 
intervals.  You cannot make any adjustments with the slider bar, it is 
simply a display aid.

The host name is deliberately kept short, so that the hands of the clock may
be more clearly seen.  Both the full host name and its current offset may be
seen as a hint by moving the mouse over the clock in question.


PLOTTING

While the clock display shows the current state, the graph tries to chose the 
trend over the past few hours.  It does this by comparing the offsets with a 
reference clock offset, assumed to be from a reliable source.  You can choose 
from either the local PC clock, or the first or last named server as a 
reference clock.

There are two functions available to improve the clarity of display for long-
term trends, Clean and Smooth.  These functions affact the display only, not 
the raw data.  The Clean function, when checked, attempts to remove spurious
values and noise from the reference clock.  This will affect all the 
displayed lines equally.  (If the reference clock is the local PC, all its 
offsets are zero, and the Clean function will have no effect).  The Smooth 
function will remove noise from each displayed line, with a loww-pass filter
function.  However, this will also result in a single transient becoming
spread into adjacent pixels.


CLOCK LIST FILE

The program reads the names of the nominated servers from a data file,
ClockList.txt in the current directory.  In the absence of this file, the
site Web server (assumed to be WWW) is monitored.  There can be up to ten
lines of ten clocks each, but it is anticipated that there will usually be
one top-level clock on the first line, perhaps three site-level primary
clocks on the second line, and some site clients which happen to offer time
services.  The node names can be blank (providing a half-clock offset) to
centralise the master clock, as in the example below:

   ,,master
   primary1, primary2, primary3
   , slave1, slave2

Using real names, you might have the following, with three primary data
sources, and two local PCs.  Note that these PCs must be time servers to be
visible to the NTPmonitor.  Note also that some time sources will object to
the 60 second interval between connections that NTPmonitor makes, so use it
wisely!  There is no need to provide fully qualified domain names for
servers within your local domain.

  time.nist.gov, ns.arc.nasa.gov, tick.usno.navy.mil
  , my_pc1, my_pc2


CLOCK LIST FILE - SPECIAL FIELDS

A special comment line in the text file will hide the graph from display:

   ; HIDEGRAPH

The keyword HIDEGRAPH can be in upper or lower case, or mixed.  You can stop
the multiple colouring, and embolden the node names:

   ; NORAINBOW

You can stop the timestamps:

   ; NOTIMESTAMPS

You can change the text in the bar at the top of the program.  The string
will be displayed in all upper case.

   ; TITLE="Edinburgh Observatory"

You can run some of these options together as in:

   ; hidegraph norainbow notimestamps title="Edinburgh Observatory"


HINTS

- holding the mouse over one of the clock panels will show the full name of
the server rather than just the first part of the name

- you can change the graph vertical scale by clicking on the Y-axis labels
(e.g. the "100ms" text).  The scale cycles from 20 msec to 5 seconds.

- because the server simply copies the version number from the client
request, all servers will be reported as version 1 (in this release of
the program!).

- the equation for round trip delay in RFC2030 is wrong.


SUPPORTED PLATFORMS

The program has been tested under Windows XP, it should run on Windows Vista
and Windows-7, and may also run on the earlier Windows 2000, NT4, 95/98 and ME.
As it is a network program, you may need to allow it through your firewall.


TERMINOLOGY

The timestamps on SNTP messages are defined in RFC2030 as:

  Reference: The time at which the local clock was last set or corrected

  Originate: The time at which the request departed the client for the server

  Receive: The time at which the request arrived at the server

  Transmit: The time at which the reply departed the server for the client

I choose to define the Return timestamp as:

  Return: The time at which client received the reply from the server

Be advised that at least one SNTP server does not fill in the Receive field,
so if NTPmonitor gets a zero originate field it substitutes the time at which
the reply departed the server.  A number of simpler SNTP servers do not 
complete the Reference field.  Tardis appears to return the Reference equal 
to the Receive timestamp.


RELEASE INFORMATION

V1.0.0  1996 Mar 12  First version
V1.0.2  1996 Mar 14  Try both NTP and TIME protcols, handle negative offsets
V2.0.0  1996 Mar 24  32-bit version, uses new DWINSOCK with UDP support
V2.0.2  1996 Apr 01  Add support for Windows NT DAYTIME protocol
                     Remember last successful protocol used with a node
V2.0.4  1996 Apr 03  Use more accurate clock comparison, and time zone info
V3.0.0  1998 Feb 11  Version for Delphi 3.02
                     Correct for Windows NT returning "Febuary"
V4.0.0  1999 Aug 14  Version for Delphi 4.02
                     Correct error in reading named sources (stratum 0 or 1)
V4.0.2  2000 Sep 18  Trap bad chars in named sources
                     Allow comment lines in clock list, start with ";"
                     Make blank clocks half-width for more elegant layout
                     Show DNS lookup of host delay on status bar
V4.0.4  2000 Oct 04  Make clock display pure UTC
                     If Receive NTP is zero, substitute Receive with Transmit
V5.0.0  2002 Sep 19  Version for Delphi 5
                     Add graphing, with choice of scale and reference filtering
                     Add plot test mode if noisy-offsets.dat present
                     Make scan interval 60 seconds
                     Move to NMUDP component from dWinsock
                     Remove runtime library dependancy
V5.0.2  2002 Sep 24  Remove date from NTP report to make clock clearer
                     Tweak "Clean" filter a little
                     Add small grey hand to clock showing milliseconds offset
                     Reduce number of ticks on trackbar to clarify zero offset
                     Add scale hint to per-clock trackbar
                     Add round-trip delay time to per-clock hint text
                     Improve potential accuracy of local time retrieval
                     When first run, interrogate first server twice
                     Reduce inter-node scan interval from 300ms to 50ms
                     Remember filter settings between runs
                     Remember plot between runs
                     Display local hours and time zone name
                     Honour user's Desktop Font setting
                     Add DNS-lookup cache
                     Correct floating-point error after 1000 minutes of running
V5.0.4  2002 Sep 28  Allow the use of any clock as a reference
                     Where 20 minutes or more data is mssing, don't plot
                     Don't display NTP version number, as it's meaningless
V5.0.6  2003 Mar 01  Work correctly with more servers
V5.0.8  2003 Nov 02  Trap case where "Return" value is zero
V5.1.0  2009 Jan 11  Allow for more line colours
                     Use line colours for node information text

Release V5.1.2.39
V5.1.2  2010 Oct 12  Add precision logging to file option (PL checkbox)
                     Add buttons for changing Y scale (replaces label click)
                     Click on right-half of clock face to refresh data
                     Click on status bar for About... box
                     Avoid history corruption when replies not received
                     Try to allow Windows to shutdown ..
                     .. rather experimental

Release V5.1.4.048
V5.1.4  2011-Jul-26  Clock list file display control entries ..
                     .. option for no graph ..
                       .. include line: ; HIDEGRAPH
                     .. option for no rainbow colours
                       .. include line: ; NORAINBOW
                     .. option for no timestamps ..
                       .. include line: ; NOTIMESTAMPS
                     .. option for main window and taskbar title ..
                       .. include line: ; TITLE="Boston Banks"
                       .. quotation marks required
                       .. line parsed to have Initial Capitals
                     Option not to plot steady values (Delta) ..
                     .. normally unchecked
                     .. side-effect of hiding very-well synced systems!
                     Option for "Plot only active" ..
                     .. if no slider visible for clock, graph is not plotted
                     Try harder not to block Windows shutdown
                     Perhaps, prevent graph lines being extended

Release V5.1.6.050
V5.1.6  2013-Dec-25  Add to clock list file display control entries ..
                     .. option for no case change ..
                     .. -NOCASECHANGE

REFERENCES

See RFC2030 for a description of SNTP, and RFC 868 for details on TIME 
protocol.  RFC 867 describes the DAYTIME protocol which is non-standard 
across implementations.  These RFCs are available on the Internet.

The program grew from Ulf Soderberg's (ulfs@sysinno.se) DWINSOCK & NETTIME,
parts of which were inspired by WINSOCK by Marc B. Manza.


PROGRAM STATUS & DISTRIBUTION

This program is copyrighted software from David J Taylor, Edinburgh and is 
provided "as is", without any support.  Whilst I cannot answer queries 
relating to the use of this program, I would value any comments or 
suggestions for improvements you may have.


AUTHOR

NTPmonitor was written by David Taylor, Edinburgh          

Web site:  http://www.satsignal.eu
E-mail:    davidtaylor@writeme.com
2013-Dec-25