xref: /freebsd/contrib/ntp/html/drivers/driver18.html (revision 2b15cb3d0922bd70ea592f0da9b4a5b167f4d53f)
19c2daa00SOllivier Robert<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
29c2daa00SOllivier Robert<html>
39c2daa00SOllivier Robert<head>
49c2daa00SOllivier Robert<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
59c2daa00SOllivier Robert<meta name="GENERATOR" content="Mozilla/4.01 [en] (Win95; I) [Netscape]">
6*2b15cb3dSCy Schubert<title>NIST/USNO/PTB Modem Time Services</title>
7ea906c41SOllivier Robert<link href="scripts/style.css" type="text/css" rel="stylesheet">
89c2daa00SOllivier Robert</head>
99c2daa00SOllivier Robert<body>
10*2b15cb3dSCy Schubert<h3>NIST/USNO/PTB Modem Time Services</h3>
11*2b15cb3dSCy Schubert<p>Author: David L. Mills (mills@udel.edu)<br>
12*2b15cb3dSCy Schubert  Last update:
13*2b15cb3dSCy Schubert  <!-- #BeginDate format:En2m -->1-Dec-2012  10:44<!-- #EndDate -->
14*2b15cb3dSCy Schubert  UTC</p>
159c2daa00SOllivier Robert<hr>
169c2daa00SOllivier Robert<h4>Synopsis</h4>
179c2daa00SOllivier Robert<p>Address: 127.127.18.<i>u</i><br>
18ea906c41SOllivier Robert  Reference ID: <tt>NIST | USNO | PTB | WWVB</tt><br>
19ea906c41SOllivier Robert  Driver ID: <tt>ACTS_MODEM</tt><br>
20ea906c41SOllivier Robert  Serial Port: <tt>/dev/acts<i>u</i></tt>; 9600 baud, 8-bits, no parity<br>
219c2daa00SOllivier Robert  Features: <tt>tty_clk</tt><br>
22ea906c41SOllivier Robert  Requires: <tt>/usr/include/sys/termios.h</tt> header file with modem control and a dial-out (cua)&nbsp;device.</p>
239c2daa00SOllivier Robert<h4>Description</h4>
24ea906c41SOllivier Robert<p>This driver supports the US (NIST and USNO) and European (PTB (Germany), NPL (UK), etc.) modem time services, as well as Spectracom GPS&nbsp;and WWVB receivers connected via a modem. The driver periodically dials a number from a telephone list, receives the timecode data and calculates the local clock correction. It is designed primarily for backup when neither a radio clock nor connectivity to Internet time servers are available. It can also be configured to operate full period.</p>
25ea906c41SOllivier Robert<p>For best results the indicated time must be corrected for the modem and telephone circuit propagation delays, which can reach 200 ms or more. For the NIST service, corrections are determined automatically by measuring the roundtrip delay of echoed characters. With this service the absolute accuracy is typically a millisecond or two. Corrections for the other services must be determined by other means. With these services variations from call to call and between messages during a call are typically a few milliseconds, occasionally higher.</p>
26ea906c41SOllivier Robert<p>This driver requires a 9600-bps modem with a Hayes-compatible command set and control over the modem data terminal ready (DTR) control line. The actual line speed ranges from 1200 bps with USNO&nbsp;to 14,400 bps with NIST. The modem setup string is hard-coded in the driver and may require changes for nonstandard modems or special circumstances.</p>
27*2b15cb3dSCy Schubert<p>There are three modes of operation selected by the <tt>mode</tt> keyword in the <tt>server</tt> configuration command. In manual mode (2) the calling program is initiated by setting fudge <tt>flag1</tt>. This can be done manually using <tt>ntpq</tt>, or by a cron job. In auto mode (0) <tt>flag1</tt> is set at each poll event. In backup mode (1) <tt>flag1</tt> is set at each poll event, but only if no other synchronization sources are available.</p>
28*2b15cb3dSCy Schubert<p>When <tt>flag1</tt> is set, the calling program dials the first number in the list specified by the <tt>phone</tt> command. If the call fails for any reason, the program dials the second number and so on. The phone number is specified by the Hayes ATDT prefix followed by the number itself, including the prefix and long-distance digits and delay code, if necessary. The <tt>flag1</tt> is reset and the calling program terminated if (a) valid clock update has been determined, (b) no more numbers remain in the list, (c) a device fault or timeout occurs or (d) fudge <tt>flag1</tt> is reset manually using <tt>ntpq</tt>.</p>
29ea906c41SOllivier Robert<p>The driver automatically recognizes the message format of each modem time service. It selects the parsing algorithm depending on the message length. There is some hazard should the message be corrupted. However, the data format is checked carefully and only if all checks succeed is the message accepted. Corrupted lines are discarded without complaint. Once the service is known, the reference identifier for the driver is set to NIST, USNO, PTB or WWVB as appropriate.</p>
30*2b15cb3dSCy Schubert<p>The Spectracom radio can be connected via a modem if the radio is configured to send time codes continuously at 1-s intervals. In principle, fudge <tt>flag2</tt> enables port locking, allowing the modem to be shared when not in use by this driver. At least on Solaris with the current NTP I/O routines, this results in lots of ugly error messages.</p>
31ea906c41SOllivier Robert<p>The <tt>minpoll</tt> and <tt>maxpoll</tt> keywords of the server configuration command can be used to limit the intervals between calls. The recommended settings are 12 (1.1 hours) for <tt>minpoll</tt> and 17 (36 hours) for <tt>maxpoll</tt>. Ordinarily, the poll interval will start at <tt>minpoll</tt> and ramp up to <tt>maxpoll</tt> in a day or two.</p>
32ea906c41SOllivier Robert<h4>US Phone Numbers and Formats</h4>
33ea906c41SOllivier Robert<p>Note: Phone numbers include the entire Hayes modem command, including the <tt>ATDT</tt> and other control codes as may be necessary. For most cases only the <tt>ATDT</tt> may be necessary.</p>
34ea906c41SOllivier Robert<p><a href="http://www.boulder.nist.gov/timefreq">National Institute of Science and Technology (NIST)</a></p>
35ea906c41SOllivier Robert<p>Phone: (303) 494-4774 (Boulder, CO); (808) 335-4721 (Hawaii)</p>
36ea906c41SOllivier Robert<p><a href="http://www.boulder.nist.gov/timefreq/service/acts.htm">Data Format</a></p>
37ea906c41SOllivier Robert<p><tt>National Institute of Standards and Technology<br>
38ea906c41SOllivier Robert  Telephone Time Service, Generator 3B<br>
39ea906c41SOllivier Robert  Enter question mark &quot;?&quot; for HELP<br>
40ea906c41SOllivier Robert  MJD YR MO DA H M S ST S UT1 msADV &lt;OTM&gt;<br>
41ea906c41SOllivier Robert  47999 90-04-18 21:39:15 50 0 +.1 045.0 UTC(NIST) *<br>
42ea906c41SOllivier Robert  47999 90-04-18 21:39:16 50 0 +.1 045.0 UTC(NIST) #<br>
43ea906c41SOllivier Robert  ...</tt></p>
44ea906c41SOllivier Robert<p><tt>MJD</tt>, <tt>YR</tt>, <tt>ST</tt>, <tt>UT1</tt> and <tt>UTC(NIST)</tt> are not used by this driver. The <tt>&lt;OTM&gt;</tt> on-time character &quot;<tt>*</tt>&quot; changes to &quot;<tt>#</tt>&quot;&nbsp;when the delay correction is valid.</p>
45ea906c41SOllivier Robert<p><a href="http://tycho.usno.navy.mil">US Naval Observatory (USNO)</a></p>
46ea906c41SOllivier Robert<p>Phone: (202) 762-1594 (Washington, DC); (719) 567-6742 (Boulder, CO)</p>
47ea906c41SOllivier Robert<p><a href="http://tycho.usno.navy.mil/modem_time.html">Data Format</a> (two lines, repeating at one-second intervals)</p>
48ea906c41SOllivier Robert<p><tt>jjjjj nnn hhmmss UTC</tt></p>
49ea906c41SOllivier Robert<p>* on-time character for previous timecode message<br>
50ea906c41SOllivier Robert  jjjjj modified Julian day number (not used)<br>
51ea906c41SOllivier Robert  nnn day of year<br>
52ea906c41SOllivier Robert  hhmmss second of day</p>
53ea906c41SOllivier Robert<p><a href="tf582_4.html">European Phone Numbers and Formats</a></p>
54ea906c41SOllivier Robert<p><a href="http://www.spectracomcorp.com">Spectracom GPS and WWVB Receivers</a></p>
55ea906c41SOllivier Robert<p>If a modem is connected to a Spectracom receiver, this driver will call it and retrieve the time in one of two formats, 0 and 2. Ordinarily, the receiver requires a <tt>T</tt> in order to return the timecode. As this driver does not send data via the modem, it must either be configured in continuous mode or be polled by another local driver.</p>
569c2daa00SOllivier Robert<h4>Monitor Data</h4>
57*2b15cb3dSCy Schubert<p>The received timecode is written as-is to the <tt>clockstats</tt> file along with the Hayes connection and hang-up commands and result codes.</p>
589c2daa00SOllivier Robert<h4>Fudge Factors</h4>
599c2daa00SOllivier Robert<dl>
60*2b15cb3dSCy Schubert  <dt><tt>time1 <i>time</i></tt></dt>
61*2b15cb3dSCy Schubert  <dd>Specifies the time offset calibration factor, in seconds and fraction, with default 0.0.</dd>
62*2b15cb3dSCy Schubert  <dt><tt>time2 <i>time</i></tt></dt>
63*2b15cb3dSCy Schubert  <dd>Not used by this driver.</dd>
64*2b15cb3dSCy Schubert  <dt><tt>stratum <i>number</i></tt></dt>
65*2b15cb3dSCy Schubert  <dd>Specifies the driver stratum, in decimal from 0 to 15, with default 0.</dd>
66*2b15cb3dSCy Schubert  <dt><tt>refid <i>string</i></tt></dt>
67*2b15cb3dSCy Schubert  <dd>Set by the driver to (one of) <tt>NIST</tt>, <tt>USNO</tt>, <tt>PTB</tt> or <tt>WWVB</tt>.</dd>
68*2b15cb3dSCy Schubert  <dt><tt>flag1 0 | 1</tt></dt>
69*2b15cb3dSCy Schubert  <dd>Initiate a call if 1. Automatically reset by program.</dd>
70*2b15cb3dSCy Schubert  <dt><tt>flag2 0 | 1</tt></dt>
71*2b15cb3dSCy Schubert  <dd>Enables port locking if 1, disables if 0 (default).</dd>
72*2b15cb3dSCy Schubert  <dt><tt>flag3 0 | 1</tt></dt>
73*2b15cb3dSCy Schubert  <dd>Not used by this driver.</dd>
74*2b15cb3dSCy Schubert  <dt><tt>flag4 0 | 1</tt></dt>
75*2b15cb3dSCy Schubert  <dd>Not used by this driver.</dd>
769c2daa00SOllivier Robert</dl>
779c2daa00SOllivier Robert<h4>Additional Information</h4>
789c2daa00SOllivier Robert<p><a href="../refclock.html">Reference Clock Drivers</a>&nbsp;</p>
799c2daa00SOllivier Robert<hr>
80ea906c41SOllivier Robert<script type="text/javascript" language="javascript" src="scripts/footer.txt"></script>
819c2daa00SOllivier Robert</body>
829c2daa00SOllivier Robert</html>
83