-<html><head><title>
-Reference Clock Options
-</title></head><body><h3>
-Reference Clock Options
-</h3>
-
-<img align=left src=pic/boom4.gif><a href=http://www.eecis.udel.edu/~mills/pictures.htm>from <i>Pogo</i>, Walt Kelly</a>
-
-<p>See the radios, all in a row.
-<br clear=left><hr>
-
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html>
+<head>
+<meta name="generator" content="HTML Tidy, see www.w3.org">
+<title>Reference Clock Options</title>
+</head>
+<body>
+<h3>Reference Clock Options</h3>
+
+<img align="left" src="pic/boom4.gif" alt="gif"><a href=
+"http://www.eecis.udel.edu/~mills/pictures.htm">from <i>Pogo</i>,
+Walt Kelly</a>
+
+<p>See the radios, all in a row.<br clear="left">
+</p>
+
+<hr>
<h4>Reference Clock Support</h4>
-The NTP Version 4 daemon supports some three dozen different radio, satellite and modem reference clocks plus a special pseudo-clock used for backup or when no other clock source is available. Detailed descriptions of individual device drivers and options can be found in the <a HREF="refclock.htm">Reference Clock Drivers </a>page. Additional information can be found in the pages linked there, including the <a HREF="rdebug.htm">Debugging Hints for Reference Clock Drivers</a> and <a HREF="howto.htm">How To Write a Reference Clock Driver</a> pages. In addition, support for a PPS signal is available as described in <a HREF="pps.htm">Pulse-per-second (PPS) Signal Interfacing</a> page. Many drivers support special line discipline/streams modules which can significantly improve the accuracy using the driver. These are described in the <a HREF="ldisc.htm">Line Disciplines and Streams Drivers</a>
-page.
-
-<p>A reference clock will generally (though not always) be a radio timecode receiver which is synchronized to a source of standard time such as the services offered by the NRC in Canada and NIST and USNO in the US. The interface between the computer and the timecode receiver is device dependent, but is usually a serial port. A device driver specific to each reference clock must be selected and compiled in the distribution; however, most common radio, satellite and modem clocks are included by default. Note that an attempt to configure a reference clock when the driver has not been compiled or the hardware port has not been appropriately configured results in a scalding remark to the system log file, but is otherwise non hazardous.
-
-<p>For the purposes of configuration, <tt>ntpd</tt> treats reference clocks in a manner analogous to normal NTP peers as much as possible. Reference clocks are identified by a syntactically correct but invalid IP address, in order to distinguish them from normal NTP peers. Reference clock addresses are of the form <tt>127.127.<i>t.u</i></tt>, where <i><tt>t</tt></i> is an integer denoting the clock type and <i><tt>u</tt></i> indicates the unit number in the range 0-3. While it may seem overkill, it is in fact sometimes useful to configure multiple reference clocks of the same type, in which case the unit numbers must be unique.
-
-<p>The <tt>server</tt> command is used to configure a reference clock, where the <i><tt>address</tt></i> argument in that command is the clock address. The <tt>key</tt>, <tt>version</tt> and <tt>ttl</tt> options are not used for reference clock support. The <tt>mode</tt> option is added for reference clock support, as described below. The <tt>prefer</tt> option can be useful to persuade the server to cherish a reference clock with somewhat more enthusiasm than other reference clocks or peers. Further information on this option can be found in the <a HREF="prefer.htm">Mitigation Rules and the <tt>prefer</tt> Keyword </a>page. The <tt>minpoll</tt> and <tt>maxpoll</tt> options have meaning only for selected clock drivers. See the individual clock driver document pages for additional information.
+<p>The NTP Version 4 daemon supports some three dozen different
+radio, satellite and modem reference clocks plus a special
+pseudo-clock used for backup or when no other clock source is
+available. Detailed descriptions of individual device drivers and
+options can be found in the <a href="refclock.htm">Reference Clock
+Drivers</a> page. Additional information can be found in the pages
+linked there, including the <a href="rdebug.htm">Debugging Hints
+for Reference Clock Drivers</a> and <a href="howto.htm">How To
+Write a Reference Clock Driver</a> pages. In addition, support for
+a PPS signal is available as described in <a href="pps.htm">
+Pulse-per-second (PPS) Signal Interfacing</a> page. Many drivers
+support special line discipline/streams modules which can
+significantly improve the accuracy using the driver. These are
+described in the <a href="ldisc.htm">Line Disciplines and Streams
+Drivers</a> page.</p>
+
+<p>A reference clock will generally (though not always) be a radio
+timecode receiver which is synchronized to a source of standard
+time such as the services offered by the NRC in Canada and NIST and
+USNO in the US. The interface between the computer and the timecode
+receiver is device dependent, but is usually a serial port. A
+device driver specific to each reference clock must be selected and
+compiled in the distribution; however, most common radio, satellite
+and modem clocks are included by default. Note that an attempt to
+configure a reference clock when the driver has not been compiled
+or the hardware port has not been appropriately configured results
+in a scalding remark to the system log file, but is otherwise non
+hazardous.</p>
+
+<p>For the purposes of configuration, <tt>ntpd</tt> treats
+reference clocks in a manner analogous to normal NTP peers as much
+as possible. Reference clocks are identified by a syntactically
+correct but invalid IP address, in order to distinguish them from
+normal NTP peers. Reference clock addresses are of the form <tt>
+127.127.<i>t.u</i></tt>, where <i><tt>t</tt></i> is an integer
+denoting the clock type and <i><tt>u</tt></i> indicates the unit
+number in the range 0-3. While it may seem overkill, it is in fact
+sometimes useful to configure multiple reference clocks of the same
+type, in which case the unit numbers must be unique.</p>
+
+<p>The <tt>server</tt> command is used to configure a reference
+clock, where the <i><tt>address</tt></i> argument in that command
+is the clock address. The <tt>key</tt>, <tt>version</tt> and <tt>
+ttl</tt> options are not used for reference clock support. The <tt>
+mode</tt> option is added for reference clock support, as described
+below. The <tt>prefer</tt> option can be useful to persuade the
+server to cherish a reference clock with somewhat more enthusiasm
+than other reference clocks or peers. Further information on this
+option can be found in the <a href="prefer.htm">Mitigation Rules
+and the <tt>prefer</tt> Keyword</a> page. The <tt>minpoll</tt> and
+<tt>maxpoll</tt> options have meaning only for selected clock
+drivers. See the individual clock driver document pages for
+additional information.</p>
+
+<p>The <tt>fudge</tt> command is used to provide additional
+information for individual clock drivers and normally follows
+immediately after the <tt>server</tt> command. The <i><tt>
+address</tt></i> argument specifies the clock address. The <tt>
+refid</tt> and <tt>stratum</tt> options control can be used to
+override the defaults for the device. There are two optional
+device-dependent time offsets and four flags that can be included
+in the <tt>fudge</tt> command as well.</p>
+
+<p>The stratum number of a reference clock is by default zero.
+Since the <tt>ntpd</tt> daemon adds one to the stratum of each
+peer, a primary server ordinarily displays an external stratum of
+one. In order to provide engineered backups, it is often useful to
+specify the reference clock stratum as greater than zero. The <tt>
+stratum</tt> option is used for this purpose. Also, in cases
+involving both a reference clock and a pulse-per-second (PPS)
+discipline signal, it is useful to specify the reference clock
+identifier as other than the default, depending on the driver. The
+<tt>refid</tt> option is used for this purpose. Except where noted,
+these options apply to all clock drivers.</p>
-<p>The <tt>fudge</tt> command is used to provide additional information for individual clock drivers and normally follows immediately after the <tt>server</tt> command. The <i><tt>address</tt></i> argument specifies the clock address. The <tt>refid</tt> and <tt>stratum</tt> options control can be used to override the defaults for the device. There are two optional device-dependent time offsets and four flags that can be included in the <tt>fudge</tt> command as well.
+<h4>Reference Clock Commands</h4>
-<p>The stratum number of a reference clock is by default zero. Since the <tt>ntpd</tt> daemon adds one to the stratum of each peer, a primary server ordinarily displays an external stratum of one. In order to provide engineered backups, it is often useful to specify the reference clock stratum as greater than zero. The <tt>stratum</tt> option is used for this purpose. Also, in cases involving both a reference clock and a pulse-per-second (PPS) discipline signal, it is useful to specify the reference clock identifier as other than the default, depending on the driver. The <tt>refid</tt> option is used for this purpose. Except where noted, these options apply to all clock drivers.
+<dl>
+<dt><tt>server 127.127.<i>t.u</i> [prefer] [mode <i>int</i>]
+[minpoll <i>int</i>] [maxpoll <i>int</i>]</tt></dt>
-<h4>Reference Clock Commands</h4>
+<dd>This command can be used to configure reference clocks in
+special ways. The options are interpreted as follows:</dd>
-<dl><dt><tt>server 127.127.<i>t.u</i> [prefer] [mode <i>int</i>] [minpoll <i>int</i>] [maxpoll <i>int</i>]</tt></dt> <dd>This command can be used to configure reference clocks in special ways. The options are interpreted as follows:</dd>
+<dd>
+<dl>
+<dt><tt>prefer</tt></dt>
-<dl><dt><tt>prefer</tt></dt>
-<dd>Marks the reference clock as preferred. All other things being equal, this host will be chosen for synchronization among a set of correctly operating hosts. See the <a HREF="prefer.htm">Mitigation Rules and the <tt>prefer</tt> Keyword </a>page for further information.</dd>
+<dd>Marks the reference clock as preferred. All other things being
+equal, this host will be chosen for synchronization among a set of
+correctly operating hosts. See the <a href="prefer.htm">Mitigation
+Rules and the <tt>prefer</tt> Keyword</a> page for further
+information.</dd>
<dt><tt>mode <i>int</i></tt></dt>
-<dd>Specifies a mode number which is interpreted in a device-specific fashion. For instance, it selects a dialing protocol in the ACTS driver and a device subtype in the <tt>parse</tt> drivers.</dd>
+
+<dd>Specifies a mode number which is interpreted in a
+device-specific fashion. For instance, it selects a dialing
+protocol in the ACTS driver and a device subtype in the <tt>
+parse</tt> drivers.</dd>
<dt><tt>minpoll <i>int</i></tt></dt>
-<dt><tt>maxpoll<i> int</i></tt></dt>
-<dd>These options specify the minimum and maximum polling interval for reference clock messages, in seconds to the power of two. For most directly connected reference clocks, both <tt>minpoll</tt> and <tt>maxpoll</tt> default to 6 (64 s). For modem reference clocks, <tt>minpoll</tt> defaults to 10 (17.1 m) and <tt>maxpoll</tt> defaults to 14 (4.5 h). The allowable range is 4 (16 s) to 17 (36.4 h) inclusive.</dd>
+<dt><tt>maxpoll <i>int</i></tt></dt>
+
+<dd>These options specify the minimum and maximum polling interval
+for reference clock messages, in seconds to the power of two. For
+most directly connected reference clocks, both <tt>minpoll</tt> and
+<tt>maxpoll</tt> default to 6 (64 s). For modem reference clocks,
+<tt>minpoll</tt> defaults to 10 (17.1 m) and <tt>maxpoll</tt>
+defaults to 14 (4.5 h). The allowable range is 4 (16 s) to 17 (36.4
+h) inclusive.</dd>
</dl>
+</dd>
-<dt><tt>fudge 127.127.<i>t.u</i> [time1 <i>sec</i>] [time2 <i>sec</i>]
-[stratum <i>int</i>] [refid <i>string</i>] [mode <i>int</i>] [flag1 0|1]
-[flag2 0|1] [flag3 0|1] [flag4 0|1]</tt></dt>
-<dd>This command can be used to configure reference clocks in special
-ways. It must immediately follow the <tt>server</tt> command which
-configures the driver. Note that the same capability is possible at run
-time using the <tt><a HREF="ntpdc.htm">ntpdc</a></tt> program. The
-options are interpreted as follows:</dd>
+<dt><tt>fudge 127.127.<i>t.u</i> [time1 <i>sec</i>] [time2 <i>
+sec</i>] [stratum <i>int</i>] [refid <i>string</i>] [mode <i>
+int</i>] [flag1 0|1] [flag2 0|1] [flag3 0|1] [flag4 0|1]</tt></dt>
-<dl>
+<dd>This command can be used to configure reference clocks in
+special ways. It must immediately follow the <tt>server</tt>
+command which configures the driver. Note that the same capability
+is possible at run time using the <tt><a href="ntpdc.htm">
+ntpdc</a></tt> program. The options are interpreted as
+follows:</dd>
+<dd>
+<dl>
<dt><tt>time1 <i>sec</i></tt></dt>
-<dd>Specifies a constant to be added to the time offset produced by the driver, a fixed-point decimal number in seconds. This is used as a calibration constant to adjust the nominal time offset of a particular clock to agree with an external standard, such as a precision PPS signal. It also provides a way to correct a systematic error or bias due to serial port or operating system latencies, different cable lengths or receiver internal delay. The specified offset is in addition to the propagation delay provided by other means, such as internal DIPswitches. Where a calibration for an individual system and driver is available, an approximate correction is noted in the driver documentation pages.</dd>
-<p><dd>Note: in order to facilitate calibration when more than one radio clock or PPS signal is supported, a special calibration feature is available. It takes the form of an argument to the <tt>enable</tt> command described in the <a href=miscopt.htm>Miscellaneous Options</a> page and operates as described in the <a href=refclock.hrm>Reference Clock Drivers</a> page.</dd>
+<dd>Specifies a constant to be added to the time offset produced by
+the driver, a fixed-point decimal number in seconds. This is used
+as a calibration constant to adjust the nominal time offset of a
+particular clock to agree with an external standard, such as a
+precision PPS signal. It also provides a way to correct a
+systematic error or bias due to serial port or operating system
+latencies, different cable lengths or receiver internal delay. The
+specified offset is in addition to the propagation delay provided
+by other means, such as internal DIPswitches. Where a calibration
+for an individual system and driver is available, an approximate
+correction is noted in the driver documentation pages.</dd>
+
+<dd>Note: in order to facilitate calibration when more than one
+radio clock or PPS signal is supported, a special calibration
+feature is available. It takes the form of an argument to the <tt>
+enable</tt> command described in the <a href="miscopt.htm">
+Miscellaneous Options</a> page and operates as described in the <a
+href="refclock.hrm">Reference Clock Drivers</a> page.</dd>
<dt><tt>time2 <i>secs</i></tt></dt>
-<dd>Specifies a fixed-point decimal number in seconds, which is interpreted in a driver-dependent way. See the descriptions of specific drivers in the <a HREF="refclock.htm">reference clock drivers</a> page.</dd>
+
+<dd>Specifies a fixed-point decimal number in seconds, which is
+interpreted in a driver-dependent way. See the descriptions of
+specific drivers in the <a href="refclock.htm">reference clock
+drivers</a> page.</dd>
<dt><tt>stratum <i>int</i></tt></dt>
-<dd>Specifies the stratum number assigned to the driver, an integer between 0 and 15. This number overrides the default stratum number ordinarily assigned by the driver itself, usually zero.</dd>
+
+<dd>Specifies the stratum number assigned to the driver, an integer
+between 0 and 15. This number overrides the default stratum number
+ordinarily assigned by the driver itself, usually zero.</dd>
<dt><tt>refid <i>string</i></tt></dt>
-<dd>Specifies an ASCII string of from one to four characters which defines the reference identifier used by the driver. This string overrides the default identifier ordinarily assigned by the driver itself.</dd>
-<dt><tt>mode <i>int</i></tt></dt>
-<dd>Specifies a mode number which is interpreted in a device-specific fashion. For instance, it selects a dialing protocol in the ACTS driver and a device subtype in the <tt>parse</tt> drivers.</dd>
+<dd>Specifies an ASCII string of from one to four characters which
+defines the reference identifier used by the driver. This string
+overrides the default identifier ordinarily assigned by the driver
+itself.</dd>
-<dt><tt>flag1</tt> <tt>flag2</tt> <tt>flag3</tt> <tt>flag4</tt></dt>
-<dd>These four flags are used for customizing the clock driver. The interpretation of these values, and whether they are used at all, is a function of the particular clock driver. However, by convention <tt>flag4</tt> is used to enable recording monitoring data to the <tt>clockstats</tt> file configured with the <tt>filegen</tt> command. Further information on the <tt>filegen</tt> command can be found in the <a HREF="monopt.htm">Monitoring Options </a>page.</dd>
+<dt><tt>mode <i>int</i></tt></dt>
+<dd>Specifies a mode number which is interpreted in a
+device-specific fashion. For instance, it selects a dialing
+protocol in the ACTS driver and a device subtype in the <tt>
+parse</tt> drivers.</dd>
+
+<dt><tt>flag1</tt> <tt>flag2</tt> <tt>flag3</tt> <tt>
+flag4</tt></dt>
+
+<dd>These four flags are used for customizing the clock driver. The
+interpretation of these values, and whether they are used at all,
+is a function of the particular clock driver. However, by
+convention <tt>flag4</tt> is used to enable recording monitoring
+data to the <tt>clockstats</tt> file configured with the <tt>
+filegen</tt> command. Further information on the <tt>filegen</tt>
+command can be found in the <a href="monopt.htm">Monitoring
+Options</a> page.</dd>
+</dl>
+</dd>
</dl>
-<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a>/address></a></body></html>
+<hr>
+<a href="index.htm"><img align="left" src="pic/home.gif" alt=
+"gif"></a>
+
+<address><a href="mailto:mills@udel.edu">David L. Mills
+<mills@udel.edu></a></address>
+</body>
+</html>
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
-
<head>
-
-<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
-<meta http-equiv="Content-Style-Type" content="text/css">
-<meta http-equiv="Content-Script-Type" content="text/javascript">
-
+<meta name="generator" content="HTML Tidy, see www.w3.org">
<title>JJY Receivers</title>
-
-<style type="text/css">
-<!--
-body { line-height:110%; font-family:sans-serif; }
-a { color:#0000D0; text-decoration:none; }
-a:link { color:#0000D0; }
-a:visited { color:#0000D0; }
-a:active { color:#0000D0; }
-a:hover { color:#C00040; text-decoration:underline;}
-h1 { font-size:x-large; }
-h2 { font-size:large; }
-h3 { font-size:medium; }
-h4 { font-size:medium; }
-h5 { font-size:small; }
-h6 { font-size:small; }
-img { border-style:none; border-width:0px; }
-.bold { font-weight:bold; }
-.italic { font-style:italic; }
-.bolditalic { font-weight:bold;; font-style:italic; }
-.monospace { font-family:monospace; }
-.indent { margin-left:4em; }
--->
-</style>
-
</head>
-
<body>
-
-<h1>JJY Receiver</h1>
+<h3>JJY Receivers</h3>
<hr>
+<h4>Synopsis</h4>
-<h2>Synopsis</h2>
+Address: 127.127.40.<i>u</i> <br>
+Reference ID: <tt>JJY</tt> <br>
+Driver ID: <tt>JJY</tt> <br>
+Serial Port: <tt>/dev/jjy<i>u</i></tt>; 9600 baud, 8-bits, no
+parity, 1 stop bit
-<table cellpadding="2" cellspacing="0" border="0">
-<tr><td>Address </td><td>: </td><td class="monospace">127.127.40.<span class="italic">X</span></td></tr>
-<tr><td>Reference ID </td><td>: </td><td class="monospace">JJY</td></tr>
-<tr><td>Driver ID </td><td>: </td><td class="monospace">JJY</td></tr>
-<tr><td>Serial Device</td><td>: </td><td class="monospace">/dev/jjy<span class="italic">X</span></td></tr>
-<tr><td>Serial Port </td><td>: </td><td class="monospace">9600 BPS, 8-bits, No parity, 1-stop-bit</td></tr>
-</table>
+<h4>Description</h4>
-<h2>Description</h2>
+<p>This driver supports the following JJY receivers sold in
+Japan.</p>
-<p>
-This driver supports following JJY receivers sold in Japan.<br>
+<ul>
+<li>
+<p>Tristate Ltd. JJY01 <a href=
+"http://www.tristate.ne.jp/rf-clock.htm">
+http://www.tristate.ne.jp/rf-clock.htm</a> (Japanese only)<br>
+Time code format<br>
</p>
-<ul>
+<table>
+<tr>
+<td>Command</td>
+<td>Reply</td>
+</tr>
-<li><span class="bold">Tristate Ltd. JJY01</span><br><br>
-Information<br>
-<a href="http://www.tristate.ne.jp/rf-clock.htm">http://www.tristate.ne.jp/rf-clock.htm</a> ( Written in Japanese only )<br>
-<br>
-Time code format<br>
-<table cellpadding="2" cellspacing="0" border="1">
-<tr><td>Command</td><td>Reply</td></tr>
-<tr class="monospace"><td>date<CR><LF></td><td>YYYY/MM/DD WWW<CR><LF></td></tr>
-<tr class="monospace"><td>stim<CR><LF></td><td>HH:MM:SS<CR><LF></td></tr>
+<tr>
+<td><tt>date<CR><LF></tt></td>
+<td><tt>YYYY/MM/DD WWW<CR><LF></tt></td>
+</tr>
+
+<tr>
+<td><tt>stim<CR><LF></tt></td>
+<td><tt>HH:MM:SS<CR><LF></tt></td>
+</tr>
</table>
-<br><br>
</li>
-<li><span class="bold">C-DEX Co.,Ltd. JST2000</span><br><br>
-Information<br>
-<a href="http://www.c-dex.co.jp/">http://www.c-dex.co.jp/</a> ( Written in Japanese only )<br>
-<br>
+<li>
+<p>C-DEX Co.,Ltd. JST2000 <a href="http://www.c-dex.co.jp/">
+http://www.c-dex.co.jp/</a> (Japanese only)<br>
Time code format<br>
-<table cellpadding="2" cellspacing="0" border="1">
-<tr><td>Command</td><td>Reply</td></tr>
-<tr class="monospace"><td><ENQ>1J<ETX></td><td><STX>JYYMMDD HHMMSSS<ETX></td></tr>
+</p>
+
+<table>
+<tr>
+<td>Command</td>
+<td>Reply</td>
+</tr>
+
+<tr>
+<td><tt><ENQ>1J<ETX></tt></td>
+<td><tt><STX>JYYMMDD HHMMSSS<ETX></tt></td>
+</tr>
</table>
-<br><br>
</li>
-
</ul>
-<p>
-The JJY is the radio station which transmites the JST ( Japan Standard Time ) in long wave radio.<br>
-The station JJY is operated by the Communication Research Laboratory.<br>
-An operating announcement and some information are avaiable from as follows;<br>
-<a href="http://www.crl.go.jp/">http://www.crl.go.jp/</a> ( English and Japanese )<br>
-<a href="http://jjy.crl.go.jp/">http://jjy.crl.go.jp/</a> ( Written in Japanese only )<br>
-</p>
+<p>JJY is the radio station which transmites the JST (Japan
+Standard Time) in long wave radio. The station JJY is operated by
+the Communication Research Laboratory. An operating announcement
+and some information are avaiable from <a href=
+"http://www.crl.go.jp/">http://www.crl.go.jp/</a> (English and
+Japanese)<a href="http://jjy.crl.go.jp/">http://jjy.crl.go.jp/</a>
+(Written in Japanese only</p>
-<h2>Serial Port Configuration</h2>
+<p>The user is expected to provide a symbolic link to an available
+serial port device. This is typically performed by a command such
+as:</p>
-<p>
-The driver attempts to open the device <span class="bold">/dev/jjy</span><span class="bolditalic">X</span>
-where <span class="bolditalic">X</span> is the NTP refclock unit number as defined by the LSB of the refclock address.<br>
-Valid refclock unit numbers are 0 - 3.
-</p>
-<p>
-The user is expected to provide a symbolic link to an available serial port device.<br>
-This is typically performed by a command such as:
-</p>
-<p class="monospace">ln -s /dev/ttyS0 /dev/jjy0</p>
-<p>
-Windows NT does not support symbolic links to device files. <br>
-COM<span class="italic">X</span>: is used by the driver, based on the refclock unit number,
-where unit 1 corresponds to COM1: and unit 3 corresponds to COM3:
-</p>
+<p><tt>ln -s /dev/ttyS0 /dev/jjy0</tt></p>
-<h2>NTP Configuration</h2>
+<p>Windows NT does not support symbolic links to device files.
+COM<i>X</i>: is the unit used by the driver, based on the refclock
+unit number, where unit 1 corresponds to COM1: and unit 3
+corresponds to COM3:</p>
-<p>
-The server command is used to configure the JJY receiver, where the address argument in that command is the "127.127.40.<span class="italic">X</span>".<br>
-The mode option must be added for the supported JJY receiver.<br>
-</p>
-<pre class="monospace">
-# JJY receiver
-server 127.127.40.<span class="italic">X</span> mode <span class="italic">N</span>
-#
-# Where
-# X = 0 to 3
-# N = 1 for Tristate TS-JJY01
-# 2 for C-DEX JST2000
-
-# Drift file
-driftfile /var/ntp/ntp.drift
-
-# Monitor data ( Optional )
-statsdir /var/ntp/
-filegen peerstats file peerstats type day enable
-filegen loopstats file loopstats type day enable
-filegen clockstats file clockstats type day enable
-</pre>
-
-<p>
-Samples of the configuration file "<span class="bold">ntp.conf</span>" for the JJY receiver.
-</p>
+<h4>Monitor Data</h4>
-<ul>
+<p>The driver writes each timecode as received to the <tt>
+clockstats</tt> file.</p>
-<li><span class="bold">Tristate Ltd. JJY01</span><br><br>
-<table cellpadding="5" cellspacing="0" border="1">
-<tr>
-<td>
-<pre class="monospace">
+<h4>Fudge Factors</h4>
-# JJY receiver ( Tristate JJY01 )
-server <span class="bold">127.127.40.0</span> mode <span class="bold">1</span>
+<dl>
+<dt><tt>time1 <i>time</i></tt></dt>
-# Drift file
-driftfile /var/ntp/ntp.drift
-</pre>
-</td>
-</tr>
-</table><br>
-</li>
+<dd>Specifies the time offset calibration factor, in seconds and
+fraction, with default 0.0.</dd>
-<li><span class="bold">C-DEX Co.,Ltd. JST2000</span><br><br>
-<table cellpadding="5" cellspacing="0" border="1">
-<tr>
-<td>
-<pre class="monospace">
+<dt><tt>time2 <i>time</i></tt></dt>
-# JJY receiver ( C-DEX JST2000 )
-server <span class="bold">127.127.40.0</span> mode <span class="bold">2</span>
+<dd>Not used by this driver.</dd>
-# Drift file
-driftfile /var/ntp/ntp.drift
-</pre>
-</td>
-</tr>
-</table><br>
-</li>
+<dt><tt>stratum <i>number</i></tt></dt>
-</ul>
+<dd>Specifies the driver stratum, in decimal from 0 to 15, with
+default 0.</dd>
+<dt><tt>refid <i>string</i></tt></dt>
-<h2>Fudge Factors</h2>
-<dl>
+<dd>Specifies the driver reference identifier, an ASCII string from
+one to four characters, with default <tt>WWVB</tt>.</dd>
-<dt>time1 time</dt>
-<dd>Specifies the time offset calibration factor, in seconds and fraction, with default 0.0.</dd>
+<dt><tt>flag1 0 | 1</tt></dt>
-<dt>time2 time</dt>
<dd>Not used by this driver.</dd>
-<dt>stratum number</dt>
-<dd>Specifies the driver stratum, in decimal from 0 to 15, with default 0.</dd>
+<dt><tt>flag2 0 | 1</tt></dt>
-<dt>refid string</dt>
-<dd>Specifies the driver reference identifier, an ASCII string, with default JJY.</dd>
-
-<dt>flag1 0 | 1</dt>
<dd>Not used by this driver.</dd>
-<dt>flag2 0 | 1</dt>
-<dd>Not used by this driver.</dd>
+<dt><tt>flag3 0 | 1</tt></dt>
-<dt>flag3 0 | 1</dt>
<dd>Not used by this driver.</dd>
-<dt>flag4 0 | 1</dt>
-<dd>Not used by this driver.</dd>
+<dt><tt>flag4 0 | 1</tt></dt>
+<dd>Enable verbose <tt>clockstats</tt> recording if set.</dd>
</dl>
-<h2>Monitor Data</h2>
-
-<p>
-A timecode is written to the <span class="bold">clockstats</span> file, if the ntpd is configured to enable writing of statistics records<br>
-</p>
-
<hr>
+<a href="index.htm"><img align="left" src="pic/home.gif" alt=
+"gif"></a>
-<p>
-Copyright (C) 2001, Takao Abe. All rights reserved.<br>
-Questions or Comments : <a href="mailto:abetakao@bea.hi-ho.ne.jp">abetakao@bea.hi-ho.ne.jp</a>
-</p>
-
-<p>
-This driver is developed in my private time, and is opened as voluntary contributions for the NTP.<br>
-The manufacturer of the JJY receiver has not participated in a development of this driver.<br>
-The manufacturer does not warrant anything about this driver, and is not liable for anything about this driver.
-</p>
-
+<address><a href="mailto:mills@udel.edu">David L. Mills
+<mills@udel.edu></a></address>
</body>
-
</html>
+
-<html>
-<head>
-<meta http-equiv="Content-Style-Type" content="text/css">
-<title>
+<html><head><title>
Stations, Frequencies and Geographic Coordinates
-</title>
-<style type="text/css">
-<!--
-a.StationInfo:link { color:#0000D0; text-decoration:none; }
-a.StationInfo:visited { color:#0000D0; text-decoration:none; }
-a.StationInfo:active { color:#0000D0; text-decoration:none; }
-a.StationInfo:hover { color:#C00040; text-decoration:underline; }
--->
-</style>
-</head>
-
-<body><h3>
+</title></head><body><h3>
Stations, Frequencies and Geographic Coordinates
</h3><hr>
<td>47:10N 2:12E</td>
</tr>
-<tr>
-<td><a class="StationInfo" href="http://jjy.crl.go.jp/">JJY</a> ( Fukushima, JAPAN )</td>
-<td>40 KHz</td>
-<td>37:22 N 140:51 E</td>
-</tr>
-
-<tr>
-<td><a class="StationInfo" href="http://jjy.crl.go.jp/">JJY</a> ( Saga, JAPAN )</td>
-<td>60 KHz</td>
-<td>33:28 N 130:11 E</td>
-</tr>
-
</table>
<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a
(<tt>GPS_ONCORE</tt>)<br>
Type 31 Rockwell Jupiter GPS (<tt>GPS_JUPITER</tt>)<br>
<a href="driver32.htm">Type 32</a> Chrono-log K-series WWVB
-receiver <a href="driver33.htm">Type 33</a> Dumb Clock <a href=
-"driver34.htm">Type 34</a> Ultralink WWVB Receivers<br>
+receiver (<tt>CHRONOLOG</tt>)<br>
+<a href="driver33.htm">Type 33</a> Dumb Clock (<tt>DUMBCLOCK</tt>)<br>
+<a href="driver34.htm">Type 34</a> Ultralink WWVB Receivers (<tt>ULINK</tt>)<br>
<a href="driver35.htm">Type 35</a> Conrad Parallel Port Radio Clock
(<tt>PCF</tt>)<br>
<a href="driver36.htm">Type 36</a> Radio WWV/H Audio
-Demodulator/Decoder(<tt>WWV</tt>)<br>
+Demodulator/Decoder (<tt>WWV</tt>)<br>
<a href="driver37.htm">Type 37</a> Forum Graphic GPS Dating station
(<tt>FG</tt>)<br>
<a href="driver38.htm">Type 38</a> hopf GPS/DCF77 6021/komp for
Serial Line (<tt>HOPF_S</tt>)<br>
<a href="driver39.htm">Type 39</a> hopf GPS/DCF77 6039 for PCI-Bus
(<tt>HOPF_P</tt>)<br>
-<a href="driver40.htm">Type 40</a> The Tristate Ltd. JJY receiver
-(<tt>JJY</tt>)<br>
+<a href="driver40.htm">Type 40</a> JJY Receivers (<tt>JJY</tt>)<br>
</p>
+
<p>* All TrueTime receivers are now supported by one driver, type
5. Types 15 and 25 will be retained only for a limited time and may
/*
* Values for peer.stratum, sys_stratum
*/
-#define STRATUM_REFCLOCK ((u_char)0) /* stratum claimed by primary clock */
+#define STRATUM_REFCLOCK ((u_char)0) /* default stratum */
/* A stratum of 0 in the packet is mapped to 16 internally */
#define STRATUM_PKT_UNSPEC ((u_char)0) /* unspecified in packet */
#define STRATUM_UNSPEC ((u_char)16) /* unspecified */
*/
double fudgetime1; /* fudge time1 */
double fudgetime2; /* fudge time2 */
+ u_char stratum; /* server stratum */
u_int32 refid; /* reference identifier */
u_char sloppyclockflag; /* fudge flags */
break;
case CP_REFID:
- if (peer->stratum > 1) {
- if (peer->flags & FLAG_REFCLOCK)
- ctl_putadr(peer_var[CP_REFID].text,
- peer->srcadr.sin_addr.s_addr);
- else
+ if (peer->flags & FLAG_REFCLOCK) {
+ if (peer->stratum > 0)
ctl_putadr(peer_var[CP_REFID].text,
peer->refid);
+ else
+ ctl_putid(peer_var[CP_REFID].text,
+ (char *)&peer->refid);
} else {
- ctl_putid(peer_var[CP_REFID].text,
- (char *)&peer->refid);
+ if (peer->stratum > 1)
+ ctl_putadr(peer_var[CP_REFID].text,
+ peer->refid);
+ else
+ ctl_putid(peer_var[CP_REFID].text,
+ (char *)&peer->refid);
}
break;
etemp = fll[i];
dtemp = max(mu, ULOGTOD(allan_xpt));
flladj = ((fp_offset - last_offset) +
- (fp_offset - clock_offset)) * etemp /
+ (clock_offset - last_offset)) * etemp /
(dtemp * CLOCK_FLL);
dtemp = ULOGTOD(SHIFT_PLL + 2 + sys_poll);
etemp = min(mu, ULOGTOD(sys_poll));
/*
* If no survivors remain at this point, check if the local
* clock or modem drivers have been found. If so, nominate one
- * of them as the only survivor. Otherwise, give up and declare
- * us unsynchronized.
+ * of them as the only survivor. Otherwise, give up and leave
+ * the island to the rats.
*/
if ((allow << 1) >= nlist) {
if (typeacts != 0) {
/*
* Clustering algorithm. Construct candidate list in order first
- * by stratum then by root distance. If we have more than
- * MAXCLOCK peers, keep only the best MAXCLOCK of them. Scan the
- * list to find falsetickers, who leave the island immediately.
- * If a falseticker is not configured, his association raft is
- * drowned as well, but only if at at least eight poll intervals
- * have gone by. We must leave at least one peer to collect the
- * million bucks.
+ * by stratum then by root distance, but keep only the best
+ * MAXCLOCK of them. Scan the list to find falsetickers, who
+ * leave the island immediately. If a falseticker is not
+ * configured, his association raft is drowned as well, but only
+ * if at at least eight poll intervals have gone. We must leave
+ * at least one peer to collect the million bucks.
*
- * Note the hysteresis gimmick that decreases the effective
- * distance for those rascals that previously have made the
- * final cut. This to discourage clockhopping.
+ * Note the hysteresis gimmick that increases the effective
+ * distance for those rascals that have not made the final cut.
+ * This is to discourage clockhopping.
*/
j = 0;
for (i = 0; i < nlist; i++) {
peer_list[i]->offset);
f /= nlist - 1;
}
- f = max(f, SQUARE(LOGTOD(sys_precision)));
if (f * synch[i] > e) {
sys_selerr = f;
e = f * synch[i];
k = i;
}
}
-
- if (nlist <= NTP_MINCLOCK || sys_selerr <= d ||
+ f = max(sys_selerr, SQUARE(LOGTOD(sys_precision)));
+ if (nlist <= NTP_MINCLOCK || f <= d ||
peer_list[k]->flags & FLAG_PREFER)
break;
#ifdef DEBUG
#ifdef OPENSSL
/*
* In manycast client mode we may have spooked a sizeable number
- * of servers that we don't need. If there are at least
+ * of peers that we don't need. If there are at least
* NTP_MINCLOCK of them, the manycast message will be turned
* off. By the time we get here we nay be ready to prune some of
* them back, but we want to make sure all the candicates have
* peers. We want only a peer at the lowest stratum to become
* the system peer, although all survivors are eligible for the
* combining algorithm. First record their order, diddle the
- * flags and clamp the poll intervals. Then, consider the peers
- * at the lowest stratum. Of these, OR the leap bits on the
- * assumption that, if some of them honk nonzero bits, they must
- * know what they are doing. Also, check for prefer and pps
- * peers. If a prefer peer is found within clock_max, update the
- * pps switch. Of the other peers not at the lowest stratum,
- * check if the system peer is among them and, if found, zap
- * him. We note that the head of the list is at the lowest
+ * flags and clamp the poll intervals. Then, consider each peer
+ * in turn and OR the leap bits on the assumption that, if some
+ * of them honk nonzero bits, they must know what they are
+ * doing. Check for prefer and pps peers at any stratum. Check
+ * if the old system peer is among the peers at the lowest
+ * stratum. Note that the head of the list is at the lowest
* stratum and that unsynchronized peers cannot survive this
* far.
*
* a majority of the suckers that have been found reachable and
* no prior source is available. This avoids the transient when
* one of a flock of sources is out to lunch and just happens
- * to be the first survivor.
+ * to be the first survivor found.
*/
if (osys_peer == NULL && 2 * nlist < min(nreach, NTP_MINCLOCK))
return;
peer->status = CTL_PST_SEL_SYNCCAND;
peer->flags |= FLAG_SYSPEER;
peer->hyst = HYST;
- if (peer->stratum == peer_list[0]->stratum) {
- leap_consensus |= peer->leap;
- if (peer->refclktype == REFCLK_ATOM_PPS &&
- peer->stratum < STRATUM_UNSPEC)
- typepps = peer;
- if (peer == osys_peer)
+ leap_consensus |= peer->leap;
+ if (peer->flags & FLAG_PREFER)
+ sys_prefer = peer;
+ if (peer->refclktype == REFCLK_ATOM_PPS &&
+ peer->stratum < STRATUM_UNSPEC)
+ typepps = peer;
+ if (peer->stratum == peer_list[0]->stratum && peer ==
+ osys_peer)
typesystem = peer;
- if (peer->flags & FLAG_PREFER)
- sys_prefer = peer;
- }
}
/*
/*
* Find the precision of this particular machine
*/
-#define DUSECS 1000000 /* us in a s */
-#define HUSECS (1 << 20) /* approx DUSECS for shifting etc */
-#define MINSTEP 5 /* minimum clock increment (us) */
-#define MAXSTEP 20000 /* maximum clock increment (us) */
-#define MINLOOPS 5 /* minimum number of step samples */
+#define MINSTEP 100e-9 /* minimum clock increment (s) */
+#define MAXSTEP 20e-3 /* maximum clock increment (s) */
+#define MINLOOPS 5 /* minimum number of step samples */
/*
- * This routine calculates the differences between successive calls to
- * gettimeofday(). If a difference is less than zero, the us field
- * has rolled over to the next second, so we add a second in us. If
- * the difference is greater than zero and less than MINSTEP, the
- * clock has been advanced by a small amount to avoid standing still.
- * If the clock has advanced by a greater amount, then a timer interrupt
- * has occurred and this amount represents the precision of the clock.
- * In order to guard against spurious values, which could occur if we
- * happen to hit a fat interrupt, we do this for MINLOOPS times and
- * keep the minimum value obtained.
+ * This routine calculates the system precision, defined as the minimum
+ * of a sequency of differences between successive readings of the
+ * system clock. However, if the system clock can be read more than once
+ * during a tick interval, the difference can be zero or one LSB unit,
+ * where the LSB corresponds to one nanosecond or one microsecond.
+ * Conceivably, if some other process preempts this one and reads the
+ * clock, the difference can be more than one LSB unit.
+ *
+ * For hardware clock frequencies of 10 MHz or less, we assume the
+ * logical clock advances only at the hardware clock tick. For higher
+ * frequencies, we assume the logical clock can advance no more than 100
+ * nanoseconds between ticks.
*/
int
default_get_precision(void)
{
- struct timeval tp;
-#if !defined(SYS_WINNT) && !defined(VMS) && !defined(_SEQUENT_) && \
- !defined(MPE)
- struct timezone tzp;
-#elif defined(VMS) || defined(_SEQUENT_)
- struct timezone {
- int tz_minuteswest;
- int tz_dsttime;
- } tzp;
-#endif /* defined(VMS) || defined(_SEQUENT_) */
- long last;
- int i;
- long diff;
- long val;
- long usec;
-#ifdef HAVE_GETCLOCK
- struct timespec ts;
-#endif
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- u_long freq;
- size_t j;
-
- /* Try to see if we can find the frequency of of the counter
- * which drives our timekeeping
- */
- j = sizeof freq;
- i = sysctlbyname("kern.timecounter.frequency", &freq, &j , 0,
- 0);
- if (i)
- i = sysctlbyname("machdep.tsc_freq", &freq, &j , 0, 0);
- if (i)
- i = sysctlbyname("machdep.i586_freq", &freq, &j , 0, 0);
- if (i)
- i = sysctlbyname("machdep.i8254_freq", &freq, &j , 0,
- 0);
- if (!i) {
- for (i = 1; freq ; i--)
- freq >>= 1;
- return (i);
- }
-#endif
- usec = 0;
- val = MAXSTEP;
-#ifdef HAVE_GETCLOCK
- (void) getclock(TIMEOFDAY, &ts);
- tp.tv_sec = ts.tv_sec;
- tp.tv_usec = ts.tv_nsec / 1000;
-#else /* not HAVE_GETCLOCK */
- GETTIMEOFDAY(&tp, &tzp);
-#endif /* not HAVE_GETCLOCK */
- last = tp.tv_usec;
- for (i = 0; i < MINLOOPS && usec < HUSECS;) {
-#ifdef HAVE_GETCLOCK
- (void) getclock(TIMEOFDAY, &ts);
- tp.tv_sec = ts.tv_sec;
- tp.tv_usec = ts.tv_nsec / 1000;
-#else /* not HAVE_GETCLOCK */
- GETTIMEOFDAY(&tp, &tzp);
-#endif /* not HAVE_GETCLOCK */
- diff = tp.tv_usec - last;
- last = tp.tv_usec;
- if (diff < 0)
- diff += DUSECS;
- usec += diff;
- if (diff > MINSTEP) {
- i++;
- if (diff < val)
- val = diff;
- }
+ l_fp val; /* current seconds fraction */
+ l_fp last; /* last seconds fraction */
+ l_fp diff; /* difference */
+ double tick; /* computed tick value */
+ double dtemp; /* scratch */
+ int i; /* log2 precision */
+
+ /*
+ * Loop to find tick value in nanoseconds. Toss out outlyer
+ * values less than the minimun tick value. In wacky cases, use
+ * the default maximum value.
+ */
+ get_systime(&last);
+ tick = MAXSTEP;
+ for (i = 0; i < MINLOOPS;) {
+ get_systime(&val);
+ diff = val;
+ L_SUB(&diff, &last);
+ last = val;
+ LFPTOD(&diff, dtemp);
+ if (dtemp < MINSTEP)
+ continue;
+ i++;
+ if (dtemp < tick)
+ tick = dtemp;
}
+
+ /*
+ * Find the nearest power of two.
+ */
NLOG(NLOG_SYSINFO)
- msyslog(LOG_INFO, "precision = %ld usec", val);
- if (usec >= HUSECS)
- val = MINSTEP; /* val <= MINSTEP; fast machine */
- diff = HUSECS;
- for (i = 0; diff > val; i--)
- diff >>= 1;
- return (i);
+ msyslog(LOG_INFO, "precision = %.3f usec", tick * 1e6);
+ for (i = 0; tick <= 1; i++)
+ tick *= 2;;
+ if (tick - 1. > 1. - tick / 2)
+ i--;
+ return (-i);
}
/*
peer->refclktype = clktype;
peer->refclkunit = unit;
peer->flags |= FLAG_REFCLOCK;
- peer->stratum = STRATUM_REFCLOCK;
- peer->refid = peer->srcadr.sin_addr.s_addr;
peer->maxpoll = peer->minpoll;
-
+ peer->stratum = STRATUM_REFCLOCK;
pp->type = clktype;
pp->timestarted = current_time;
* Set peer.pmode based on the hmode. For appearances only.
*/
switch (peer->hmode) {
-
- case MODE_ACTIVE:
+ case MODE_ACTIVE:
peer->pmode = MODE_PASSIVE;
break;
- default:
+ default:
peer->pmode = MODE_SERVER;
break;
}
}
peer->hpoll = peer->minpoll;
peer->ppoll = peer->maxpoll;
- if (peer->stratum <= 1)
- peer->refid = pp->refid;
- else
- peer->refid = peer->srcadr.sin_addr.s_addr;
+ peer->refid = pp->refid;
return (1);
}
if (in->haveflags & CLK_HAVETIME2)
pp->fudgetime2 = in->fudgetime2;
if (in->haveflags & CLK_HAVEVAL1)
- peer->stratum = (u_char) in->fudgeval1;
+ pp->stratum = (u_char) in->fudgeval1;
if (in->haveflags & CLK_HAVEVAL2)
pp->refid = in->fudgeval2;
- if (peer->stratum <= 1)
+ peer->stratum = pp->stratum;
+ if (peer->stratum == 0)
peer->refid = pp->refid;
else
peer->refid = peer->srcadr.sin_addr.s_addr;
CLK_HAVEVAL2 | CLK_HAVEFLAG4;
out->fudgetime1 = pp->fudgetime1;
out->fudgetime2 = pp->fudgetime2;
- out->fudgeval1 = peer->stratum;
+ out->fudgeval1 = pp->stratum;
out->fudgeval2 = pp->refid;
out->flags = (u_char) pp->sloppyclockflag;
+
/*
* refclock_atom - clock driver for 1-pps signals
*/
pp = peer->procptr;
peer->precision = PRECISION;
pp->clockdesc = DESCRIPTION;
+ pp->stratum = STRATUM_UNSPEC;
memcpy((char *)&pp->refid, REFID, 4);
peer->burst = ASTAGE;
- peer->stratum = STRATUM_UNSPEC;
#ifdef HAVE_PPSAPI
up = emalloc(sizeof(struct ppsunit));
memset(up, 0, sizeof(struct ppsunit));
* +-0.5 s of the local time and the seconds numbering is
* unambiguous. Note that the leap bits are set no-warning on
* the first valid update and the stratum is set at the prefer
- * peer.
+ * peer, unless overriden by a fudge command.
*/
if (peer->burst > 0)
return;
- peer->stratum = STRATUM_UNSPEC;
+ peer->leap = LEAP_NOTINSYNC;
if (pp->codeproc == pp->coderecv) {
refclock_report(peer, CEVNT_TIMEOUT);
peer->burst = ASTAGE;
return;
- } else if (!sys_prefer) {
+ } else if (sys_prefer == NULL) {
pp->codeproc = pp->coderecv;
peer->burst = ASTAGE;
return;
peer->burst = ASTAGE;
return;
}
- peer->stratum = sys_prefer->stratum;
- if (peer->stratum <= 1)
+ pp->leap = LEAP_NOWARNING;
+ if (pp->stratum >= STRATUM_UNSPEC)
+ peer->stratum = sys_prefer->stratum;
+ else
+ peer->stratum = pp->stratum;
+ if (peer->stratum == 0)
peer->refid = pp->refid;
else
- peer->refid = peer->srcadr.sin_addr.s_addr;
- pp->leap = LEAP_NOWARNING;
+ peer->refid = sys_prefer->srcadr.sin_addr.s_addr;
refclock_receive(peer);
peer->burst = ASTAGE;
}
* Initialize miscellaneous variables
*/
peer->precision = sys_precision;
- peer->stratum = STRATUM;
+ pp->stratum = STRATUM;
pp->clockdesc = DESCRIPTION;
memcpy((char *)&pp->refid, REFID, 4);
#if defined(VMS) && defined(VMS_LOCALUNIT)