File: ?\rsNTP\rsNTP.htm Web: www.qsl.net/dl4yhf/rsNTP/rsNTP.htm Author: Wolfgang 'Wolf' DL4YHF Date: 2016-05-29
Certain applications (like WSPR, a weak-signal digital mode for amateur radio) require a precise timing, and thus a precisely set system clock (date and time).
Since the available 'Internet Time' service provided by windows itself didn't work reliably, and other time-keeping software packages were difficult to install (and gave no indication of what they were doing, all they did was running as a blackbox aka 'service' in the background), the author wrote this implementation of a 'ridiculously simple NTP (Network Time Protocol) client'.
It needs no installation, doesn't install drivers, services, and other obscure stuff.
There is only one catch (Windows 7 / 8 / Vista users beware):
To successfully adjust the PC's system time to eliminate the clock error (offset in seconds) measured by NTP, it must be run 'as administrator'. The internet is full of how-to's about running a program 'as administator', so there's no need for details here. Just in short form: After unpacking the software into a directory of your choice,
right-click on 'NtpClient.exe',
select 'properties', 'compatibility',
set the checkmark 'run as administrator'.
This way, the program will be run 'as administrator' whenever you double-click its icon. The dreadful UAC may still prompt you with a warning whenever starting it this way - any suggestions how to get rid of this annoyance are most welcome.
When starting the program for the first time, select an NTP server in your country, or at least on your continent.
The combo box in the upper left corner contains a list of popular servers, but you can type the hostname
or numeric IP address ('dotted address') into that field.
For most parts of the world (and if you don't have access to an NTP server in your local network), it is recommended to use one of the NTP Pool addresses. By virtue of a DNS trick, the pool automatically picks the 'best' NTP server currently available for you.
The rsNTP window shows the current date and time in UTC, formatted according to ISO 8601, in the upper part.
To keep it simple, rsNTP doesn't care for 'local time' and national preferrences to format date and time.
To perform a single-time synchronisation of the PC's system time, click the 'Synchronize' button
in the lower left corner. The program shows verbose info in the text box in the center,
including the 'round trip' time of the UDP datagrams sent from client to server, and the response
from the server back to the client. The lower the round-trip time, the more accurate the synchronisation.
To keep the PC's system time synchronized permanently, set the checkmark 'synchronize periodically'.
The program will try to synchronize every 30 minutes, which should be ok even for the most demanding applications, and keeps the traffic at the remote NTP server low.
While 'periodically synchronising', the program only emits one line of text every 30 minutes, so the history of clock adjustments can be seen.
To avoid flooding the server with unnecessarily frequent requests, the 'Synchronize' button is disabled for a few seconds after a successful update.
For some 'very special' applications, the PC's system time can be synchronized with a 'deliberate offset'.
For example, to have the PC's system time run early by 7 seconds, enter that value in the field after 'Add[s]'
(not shown in the screenshot above, which is from an earlier version). That value (in seconds) will be added
to the precise time taken from the remote NTP server whenever attempting to synchronize the PC's local clock.
This feature was added 2015-10-02 as a kludge to compensate the propagation delay of a signal fed into into the PC, for a software (WSPR) which needed quite accurate timing, and was not aware of the additional delay caused by the audio-distribution network, digital pre-processing, etc.
Since 2016-05-29, a 'special deliberate offset' can be configured to be active only during certain times every hour. For example, the PC's system time can be set 10 seconds ahead (offset = +10.0 seconds) between 45 and 50 minutes of the hour, and something else during the rest of the hour. This feature was added to support decoding WSPR transmissions from a beacon floating on the ocean; full story at http://www.qsl.net/zl1rs/oceanfloater.html.
The screenshot below shows how and where to adjust these times:
Since 2016-06-04, the deliberate offset can also be controlled by other applications running on the same PC.
For example, there may be an audio-preprocessing software which introduces a known (but possibly variable) 'delay' in the signal path between antenna (HF receiver) and the decoding software (WSPR), which irritates the WSPR decoder's bit clock synchronisation.
Since the WSPR software had no internal method to compensate such delays, the workaround was to adjust the PC's system time. If, for example, Spectrum Lab knew that its own processing adds a 1.5 second delay to the "signal path", it can instruct the rsNTP software to add 1.5 seconds to the NTP time before setting the system time by the following interpreter command:
send("rsNTP","set offset=1.5" ); // let the NTP client add 1.5 seconds to the system time
Note: Internally, Spectrum Lab's 'send' command uses WM_COPYDATA messages to communicate with other processes. For some reason, those WM_COPYDATA messages only get through when Spectrum Lab is also run 'as admin'. rsNTP must be run 'as admin' because otherwise Windows refuses to set the PC's system time.