<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML Strict//EN">
<html><head><title>
Shared memoy Driver
</title></head><body><h3>
Shared memory Driver
</h3><hr>

<p><h4>Synopsis</h4>

<p>Address: 127.127.28.<var>u</var>
<br>Reference ID: SHM
<br>Driver ID: SHM

<p><h4>Description</h4>

<p>This driver receives its reference clock info from a shared memory-segment. 
The shared memory-segment is created with owner-only access
for unit 0 and 1, and world access for unit 2 and 3

<p><h4>Structure of shared memory-segment</h4>
<pre>
struct shmTime {
  int    mode; /* 0 - if valid set
                *       use values, 
                *       clear valid
                * 1 - if valid set 
                *       if count before and after read of 
                *       values is equal,
                *         use values 
                *       clear valid
                */
  int    count;
  time_t clockTimeStampSec;      /* external clock */
  int    clockTimeStampUSec;     /* external clock */
  time_t receiveTimeStampSec;    /* internal clock, when external value was received */
  int    receiveTimeStampUSec;   /* internal clock, when external value was received */
  int    leap;
  int    precision;
  int    nsamples;
  int    valid;
  int    dummy[10]; 
};
</pre>
<p><h4>Operation mode=0</h4>
When the poll-method of the driver is called, the valid-flag of the 
shared memory-segment is checked:
<p>If set, the values in the record 
(clockTimeStampSec, clockTimeStampUSec, receiveTimeStampSec,
receiveTimeStampUSec, leap, precision) are passed to ntp, and the valid-flag 
is cleared.
<p>If not set, a timeout is reported to ntp, nothing else happend

<p><h4>Operation mode=1</h4>
When the poll-method of the driver is called, the valid-flag of the 
shared memory-segment is checked:
<p>If set, the count-field of the record is remembered, and the values in 
the record (clockTimeStampSec, clockTimeStampUSec, receiveTimeStampSec,
receiveTimeStampUSec, leap, precision) are read. Then, the remembered count
is compared to the count now in the record. If both are equal, the values
read from the record are passed to ntp. If they differ, another process
has modified the record while it was read out (was not able to produce
this case), and failure is reported to ntp. The valid flag is cleared.

<p>If not set, a timeout is reported to ntp, nothing else happend
<p>

<p><h4>Fudge Factors</h4>

<dl>

<dt><code>time1 <var>time</var></code>
<dd>Specifies the time offset calibration factor, in seconds and
fraction, with default 0.0.

<p><dt><code>time2 <var>time</var></code>
<dd>Not used by this driver.

<p><dt><code>stratum <var>number</var></code>
<dd>Specifies the driver stratum, in decimal from 0 to 15, with default
0.

<p><dt><code>refid <var>string</var></code>
<dd>Specifies the driver reference identifier, an ASCII string from one
to four characters, with default <code>SHM</code>.

<p><dt><code>flag1 0 | 1</code>
<dd>Not used by this driver.

<p><dt><code>flag2 0 | 1</code>
<dd>Not used by this driver.

<p><dt><code>flag3 0 | 1</code>
<dd>Not used by this driver.

<p><dt><code>flag4 0 | 1</code>
<dd>Not used by this driver.

<p>Additional Information

<p><a href="refclock.html"> Reference Clock Drivers</a>

</dl>
