terminators.
[Bug 1238] use fudge time2 for serial timecode offset in NMEA driver.
document fudge time1 as PPS offset, fudge time2 as serial timecode offset
for driver20.html (NMEA)
bk: 4a58278cfU51ZGIMdfe9OaGRuGh_AA
+* [Bug 1237] Windows serial code treat CR and LF both as line
+ terminators.
+* [Bug 1238] use fudge time2 for serial timecode offset in NMEA driver.
(4.2.5p185) 2009/07/01 Released by Harlan Stenn <stenn@ntp.org>
* Documentation updates from Dave Mills.
* [Bug 1234] convert NMEA driver to use common PPSAPI code.
* timepps-Solaris.h pps_handle_t changed from pointer to scalar
* Spectracom refclock added to Windows port of ntpd
* [Bug 1236] Declaration order fixed.
-* Bracket private ONCORE debug statements with #if 0 rather than #ifdef DEBUG
+* Bracket private ONCORE debug statements with #if 0 rather than #ifdef
+ DEBUG
* Delete ONCORE debug statement that is now handled elsewhere.
(4.2.5p184) 2009/06/24 Released by Harlan Stenn <stenn@ntp.org>
* [Bug 1233] atom refclock fudge time1 sign flipped in 4.2.5p164.
<h4>Fudge Factors</h4>
<dl>
<dt><tt>time1 <i>time</i></tt>
- <dd>Specifies the time offset calibration factor, in seconds and fraction, with default 0.0.
+ <dd>Specifies the PPS time offset calibration factor, in seconds and fraction, with default 0.0.
<dt><tt>time2 <i>time</i></tt>
- <dd>Not used by this driver.
+ <dd>Specifies the serial end of line time offset calibration factor, in seconds and fraction, with default 0.0.
<dt><tt>stratum <i>number</i></tt>
<dd>Specifies the driver stratum, in decimal from 0 to 15, with default 0.
<dt><tt>refid <i>string</i></tt>
*
* Updated to process 'time1' fudge factor
* Venu Gopal May 05, 2008
+ *
+ * Converted to common PPSAPI code, separate PPS fudge time1
+ * from serial timecode fudge time2.
+ * Dave Hart July 1, 2009
+ * hart@ntp.org, davehart@davehart.com
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
0) {
up->pcount++,
peer->flags |= FLAG_PPS;
+ peer->precision = PPS_PRECISION;
}
}
}
char *cp, *dp, *msg;
int cmdtype;
int cmdtypezdg = 0;
+ l_fp lfp_fudgetime2;
/* Use these variables to hold data until we decide its worth keeping */
char rd_lastcode[BMAX];
l_fp rd_timestamp;
memcpy(pp->a_lastcode, rd_lastcode, pp->lencode + 1);
cp = pp->a_lastcode;
- pp->lastrec = up->tstamp = rd_timestamp;
+ DTOLFP(pp->fudgetime2, &lfp_fudgetime2);
+ L_ADD(&rd_timestamp, &lfp_fudgetime2);
+ up->tstamp = rd_timestamp;
+ pp->lastrec = up->tstamp;
DPRINTF(1, ("nmea: timecode %d %s\n", pp->lencode, pp->a_lastcode));
* timeout and keep going.
*/
#ifdef HAVE_PPSAPI
- if (up->pcount == 0)
+ if (up->pcount == 0) {
peer->flags &= ~FLAG_PPS;
+ peer->precision = PRECISION;
+ }
if (up->tcount == 0) {
pp->coderecv = pp->codeproc;
refclock_report(peer, CEVNT_TIMEOUT);
static int
OnSerialReadComplete(ULONG_PTR i, IoCompletionInfo *lpo, DWORD Bytes, int errstatus)
{
- recvbuf_t *buff;
- struct refclockio * rio = (struct refclockio *) i;
+ recvbuf_t * buff;
+ l_fp cr_time;
+ struct refclockio * rio;
+ rio = (struct refclockio *)i;
/*
* Get the recvbuf pointer from the overlapped buffer.
*/
* have fired since the port was opened.
*/
if (rio->recvcount++) {
+ cr_time = buff->recv_time;
+ add_full_recv_buffer(buff);
+ /*
+ * Mimic Unix line discipline and assume CR/LF
+ * line termination. On Unix the CR terminates
+ * the line containing the timecode, and
+ * immediately after the LF terminates an empty
+ * line. So synthesize the empty LF-terminated
+ * line using the same CR timestamp. Both CR
+ * and LF are stripped by refclock_gtlin().
+ */
+ buff = get_free_recv_buffer_alloc();
+ buff->recv_time = cr_time;
+ buff->recv_length = 0;
+ buff->fd = _get_osfhandle(rio->fd);
+ buff->receiver = rio->clock_recv;
+ buff->dstadr = NULL;
+ buff->recv_srcclock = rio->srcclock;
add_full_recv_buffer(buff);
/*
* Now signal we have something to process