From: Harlan Stenn Date: Sat, 16 Oct 1999 03:41:53 +0000 (-0000) Subject: Many files: X-Git-Tag: PRE_NT_991015^0 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=860961f3e66a9939722688906f16ef0da9442cc0;p=thirdparty%2Fntp.git Many files: * ntpd/refclock_wwvb.c: * ntpd/refclock_usno.c: * ntpd/refclock_ulink.c: * ntpd/refclock_tpro.c: * ntpd/refclock_pst.c: * ntpd/refclock_parse.c: * ntpd/refclock_palisade.c: * ntpd/refclock_oncore.c: * ntpd/refclock_mx4200.c: * ntpd/refclock_msfees.c: * ntpd/refclock_jupiter.c: * ntpd/refclock_irig.c: * ntpd/refclock_heath.c: * ntpd/refclock_chu.c: * ntpd/refclock_atom.c: * ntpd/refclock_as2201.c: * ntpd/refclock_arc.c: * ntpd/refclock_arbiter.c: * ntpd/refclock_acts.c: * ntpd/ntp_refclock.c: * include/ntp_refclock.h: Bunches of fixes. From: Dave Mills bk: 3807f401MvVwv9xT3o-VUCFg0mBhqQ --- diff --git a/ChangeLog b/ChangeLog index 6b17b410e7..1db7ab8460 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +1999-10-15 Harlan Stenn + + * ntpd/refclock_wwvb.c: + * ntpd/refclock_usno.c: + * ntpd/refclock_ulink.c: + * ntpd/refclock_tpro.c: + * ntpd/refclock_pst.c: + * ntpd/refclock_parse.c: + * ntpd/refclock_palisade.c: + * ntpd/refclock_oncore.c: + * ntpd/refclock_mx4200.c: + * ntpd/refclock_msfees.c: + * ntpd/refclock_jupiter.c: + * ntpd/refclock_irig.c: + * ntpd/refclock_heath.c: + * ntpd/refclock_chu.c: + * ntpd/refclock_atom.c: + * ntpd/refclock_as2201.c: + * ntpd/refclock_arc.c: + * ntpd/refclock_arbiter.c: + * ntpd/refclock_acts.c: + * ntpd/ntp_refclock.c: + * include/ntp_refclock.h: + Bunches of fixes. + From: Dave Mills + 1999-10-10 Harlan Stenn * html/driver16.htm: New version diff --git a/include/ntp_refclock.h b/include/ntp_refclock.h index f977c0c33f..05efc60092 100644 --- a/include/ntp_refclock.h +++ b/include/ntp_refclock.h @@ -183,10 +183,9 @@ struct refclockproc { int second; /* second of minute */ int msec; /* millisecond of second */ long usec; /* microsecond of second (alt) */ - int nstages; /* median filter stages */ - int nskeep; /* trimmed filter stages */ u_long yearstart; /* beginning of year */ - u_long coderecv; /* sample counter */ + int coderecv; /* put pointer */ + int codeproc; /* get pointer */ l_fp lastref; /* timecode timestamp */ l_fp lastrec; /* local timestamp */ double offset; /* mean offset */ @@ -237,10 +236,7 @@ struct refclock { /* * auxiliary PPS interface (implemented by refclock_atom()) */ -#ifdef PPS_SAMPLE -extern int pps_sample P((l_fp *)); -#endif - +extern int pps_sample P((l_fp *)); extern int io_addclock_simple P((struct refclockio *)); extern int io_addclock P((struct refclockio *)); extern void io_closeclock P((struct refclockio *)); @@ -255,8 +251,7 @@ extern int refclock_open P((char *, int, int)); extern void refclock_transmit P((struct peer *)); extern int refclock_ioctl P((int, int)); extern int refclock_process P((struct refclockproc *)); -extern int refclock_process_offset P((struct refclockproc *, l_fp, l_fp, double)); -extern void refclock_sample P((struct refclockproc *)); +extern void refclock_process_offset P((struct refclockproc *, l_fp, l_fp, double)); extern void refclock_report P((struct peer *, int)); extern int refclock_gtlin P((struct recvbuf *, char *, int, l_fp *)); diff --git a/ntpd/ntp_refclock.c b/ntpd/ntp_refclock.c index d172302cf3..24d785fbc9 100644 --- a/ntpd/ntp_refclock.c +++ b/ntpd/ntp_refclock.c @@ -95,6 +95,8 @@ static int refclock_cmpl_fp P((const void *, const void *)); static int refclock_cmpl_fp P((const double *, const double *)); #endif +static int refclock_sample(struct refclockproc *); + #ifdef HAVE_PPSAPI extern int pps_assert; extern int pps_hardpps; @@ -232,8 +234,6 @@ refclock_newpeer( pp->type = clktype; pp->timestarted = current_time; - pp->nstages = NSTAGE; - pp->nskeep = NSTAGE * 3 / 5; /* * If the interface has been set to any_interface, set it to the @@ -364,7 +364,7 @@ refclock_transmit( } else if (peer->valid > NTP_SHIFT - 2) hpoll++; if (peer->flags & FLAG_BURST) - peer->burst = pp->nstages; + peer->burst = NSTAGE; } peer->outdate = current_time; } @@ -415,11 +415,11 @@ refclock_cmpl_fp( /* * refclock_process_offset - process a pile of offset samples from the clock * - * This routine uses the given offset and receive time stamp - * and fill the appropriate filter buffers further processing is left to - * refclock_sample + * This routine uses the given offset and receive time stamp and fill the + * appropriate filter buffers further processing is left to refclock_sample. + * Samples that overflow the buffer are quietly discarded. */ -int +void refclock_process_offset( struct refclockproc *pp, l_fp offset, @@ -428,14 +428,15 @@ refclock_process_offset( ) { double doffset; - + + if ((pp->coderecv + 1) % MAXSTAGE == pp->codeproc % MAXSTAGE) + return; pp->lastref = offset; pp->lastrec = lastrec; pp->variance = 0; L_SUB(&offset, &lastrec); LFPTOD(&offset, doffset); - pp->filter[pp->coderecv++ % pp->nstages] = doffset + fudge; - return (1); + pp->filter[pp->coderecv++ % MAXSTAGE] = doffset + fudge; } /* @@ -468,7 +469,8 @@ refclock_process( } else { MSUTOTSF(pp->msec, offset.l_uf); } - return refclock_process_offset(pp, offset, pp->lastrec, pp->fudgetime1); + refclock_process_offset(pp, offset, pp->lastrec, pp->fudgetime1); + return (1); } /* @@ -485,30 +487,33 @@ refclock_process( * failure due to invalid timecode data or very noisy offsets. * */ -void +static int refclock_sample( struct refclockproc *pp ) { - int i, j, k; + int i, j, k, n; double offset, disp; double off[MAXSTAGE]; /* - * Copy the raw offsets and sort into ascending order. + * Copy the raw offsets and sort into ascending order. Don't do + * anything if the buffer is empty.:1 */ - for (j = 0; j < pp->nstages && (u_int)j < pp->coderecv; j++) - off[j] = pp->filter[j]; - qsort((char *)off, (u_int)j, sizeof(double), refclock_cmpl_fp); + if (pp->codeproc == pp->coderecv) + return (0); + n = 0; + while (pp->codeproc != pp->coderecv) + off[n++] = pp->filter[pp->codeproc++ % MAXSTAGE]; + if (n > 1) + qsort((char *)off, n, sizeof(double), refclock_cmpl_fp); /* * Reject the furthest from the median of the samples until - * nskeep samples remain. + * approximately 60 percent of the samples remain. */ - i = 0; - k = j; - if (k > pp->nskeep) - k = pp->nskeep; + i = 0; j = n; + k = n - (n * 2) / NSTAGE; while ((j - i) > k) { offset = off[(j + i) / 2]; if (off[j - 1] - offset < offset - off[i]) @@ -531,9 +536,10 @@ refclock_sample( #ifdef DEBUG if (debug) printf( - "refclock_sample: offset %.6f disp %.6f std %.6f\n", - pp->offset, pp->disp, SQRT(pp->variance)); + "refclock_sample: n %d offset %.6f disp %.6f std %.6f\n", + n, pp->offset, pp->disp, SQRT(pp->variance)); #endif + return (1); } @@ -579,7 +585,8 @@ refclock_receive( peer->reftime = peer->org = pp->lastrec; peer->rootdispersion = pp->disp + SQRT(pp->variance); get_systime(&peer->rec); - refclock_sample(pp); + if (!refclock_sample(pp)) + return; clock_filter(peer, pp->offset, 0., 0.); clock_select(); record_peer_stats(&peer->srcadr, ctlpeerstatus(peer), @@ -1331,10 +1338,6 @@ refclock_buginfo( bug->values[5] = pp->msec; bug->values[6] = pp->yearstart; bug->values[7] = pp->coderecv; - - bug->ntimes = pp->nstages + 3; - if (bug->ntimes > NCLKBUGTIMES) - bug->ntimes = NCLKBUGTIMES; bug->stimes = 0xfffffffc; bug->times[0] = pp->lastref; bug->times[1] = pp->lastrec; diff --git a/ntpd/refclock_acts.c b/ntpd/refclock_acts.c index 54f117826c..9c367b52ab 100644 --- a/ntpd/refclock_acts.c +++ b/ntpd/refclock_acts.c @@ -712,8 +712,6 @@ acts_receive ( pp->offset += (msADV - up->msADV) * 1000 * 1e-6; } else { up->msADV = msADV; - pp->nstages = up->msgcnt; - pp->nskeep = up->msgcnt * 2 / 3; if (!refclock_process(pp)) { refclock_report(peer, CEVNT_BADTIME); return; diff --git a/ntpd/refclock_arbiter.c b/ntpd/refclock_arbiter.c index 36bf6d00cc..045a93a1b7 100644 --- a/ntpd/refclock_arbiter.c +++ b/ntpd/refclock_arbiter.c @@ -92,7 +92,6 @@ #define REFID "GPS " /* reference ID */ #define DESCRIPTION "Arbiter 1088A/B GPS Receiver" /* WRU */ -#define ARB_NSTAGE 45 /* median filter stages */ #define LENARB 24 /* format B5 timecode length */ #define MAXSTA 30 /* max length of status string */ #define MAXPOS 70 /* max length of position string */ @@ -101,7 +100,6 @@ * ARB unit control structure */ struct arbunit { - int pollcnt; /* poll message counter */ l_fp laststamp; /* last receive timestamp */ int tcswitch; /* timecode switch/counter */ char qualchar; /* IEEE P1344 quality (TQ command) */ @@ -178,9 +176,6 @@ arb_start( peer->precision = PRECISION; pp->clockdesc = DESCRIPTION; memcpy((char *)&pp->refid, REFID, 4); - up->pollcnt = 2; - pp->nstages = ARB_NSTAGE; - pp->nskeep = ARB_NSTAGE * 3 / 5; write(pp->io.fd, "B0", 2); return (1); } @@ -287,8 +282,6 @@ arb_receive( return; } pp->lencode = temp; - up->pollcnt = 2; - up->tcswitch++; /* * We get down to business, check the timecode format and decode @@ -317,20 +310,7 @@ arb_receive( write(pp->io.fd, "B0", 2); return; } - - /* - * Process the new sample in the median filter and determine the - * timecode timestamp. - */ - if (!refclock_process(pp)) { - refclock_report(peer, CEVNT_BADTIME); - write(pp->io.fd, "B0", 2); - return; - } - if (up->tcswitch <= pp->nstages) - return; - up->tcswitch = 0; - record_clock_stats(&peer->srcadr, pp->a_lastcode); + up->tcswitch++; /* * We decode the clock dispersion from the time quality @@ -395,8 +375,15 @@ arb_receive( printf("arbiter: timecode %d %s\n", pp->lencode, pp->a_lastcode); #endif - write(pp->io.fd, "B0", 2); - refclock_receive(peer); + if (up->tcswitch >= NSTAGE) + write(pp->io.fd, "B0", 2); + + /* + * Process the new sample in the median filter and determine the + * timecode timestamp. + */ + if (!refclock_process(pp)) + refclock_report(peer, CEVNT_BADTIME); } @@ -424,16 +411,17 @@ arb_poll( */ pp = peer->procptr; up = (struct arbunit *)pp->unitptr; - if (up->pollcnt == 0) - refclock_report(peer, CEVNT_TIMEOUT); - else - up->pollcnt--; + up->tcswitch = 0; if (write(pp->io.fd, "TQ", 2) != 2) { refclock_report(peer, CEVNT_FAULT); } else pp->polls++; - up->tcswitch = 0; - + if (pp->coderecv == pp->codeproc) { + refclock_report(peer, CEVNT_TIMEOUT); + return; + } + record_clock_stats(&peer->srcadr, pp->a_lastcode); + refclock_receive(peer); } #else diff --git a/ntpd/refclock_arc.c b/ntpd/refclock_arc.c index 93965269fe..c511260783 100644 --- a/ntpd/refclock_arc.c +++ b/ntpd/refclock_arc.c @@ -1186,7 +1186,10 @@ arc_receive( } #endif - refclock_process(pp); + if (!refclock_process(pp)) { + refclock_report(peer, CEVNT_BADTIME); + return; + } refclock_receive(peer); } diff --git a/ntpd/refclock_as2201.c b/ntpd/refclock_as2201.c index 39d6550b72..e94245dca1 100644 --- a/ntpd/refclock_as2201.c +++ b/ntpd/refclock_as2201.c @@ -76,8 +76,6 @@ * AS2201 unit control structure. */ struct as2201unit { - int pollcnt; /* poll message counter */ - char *lastptr; /* statistics buffer pointer */ char stats[SMAX]; /* statistics buffer */ int linect; /* count of lines remaining */ @@ -197,11 +195,9 @@ as2201_start( * Initialize miscellaneous variables */ peer->precision = PRECISION; - peer->burst = NTP_SHIFT; + peer->burst = NSTAGE; pp->clockdesc = DESCRIPTION; memcpy((char *)&pp->refid, REFID, 4); - up->pollcnt = 2; - up->lastptr = up->stats; up->index = 0; return (1); @@ -281,7 +277,6 @@ as2201_receive( up->linect = atoi(pp->a_lastcode); return; } else { - up->pollcnt = 2; record_clock_stats(&peer->srcadr, up->stats); #ifdef DEBUG if (debug) @@ -312,6 +307,14 @@ as2201_receive( return; } + /* + * Test for synchronization (this is a temporary crock). + */ + if (pp->a_lastcode[2] != ':') + pp->leap = LEAP_NOTINSYNC; + else + pp->leap = LEAP_NOWARNING; + /* * Process the new sample in the median filter and determine the * timecode timestamp. @@ -321,15 +324,6 @@ as2201_receive( return; } - /* - * Test for synchronization (this is a temporary crock). - */ - if (pp->a_lastcode[2] != ':') - pp->leap = LEAP_NOTINSYNC; - else - pp->leap = LEAP_NOWARNING; - refclock_receive(peer); - /* * If CLK_FLAG4 is set, initialize the statistics buffer and * send the next command. If not, simply write the timecode to @@ -374,10 +368,6 @@ as2201_poll( */ pp = peer->procptr; up = (struct as2201unit *)pp->unitptr; - if (up->pollcnt == 0) - refclock_report(peer, CEVNT_TIMEOUT); - else - up->pollcnt--; if (write(pp->io.fd, "\r*toc\r", 6) != 6) { refclock_report(peer, CEVNT_FAULT); } else { @@ -385,6 +375,14 @@ as2201_poll( if (!(pp->sloppyclockflag & CLK_FLAG2)) get_systime(&pp->lastrec); } + if (peer->burst > 0) + return; + peer->burst = NSTAGE; + if (pp->coderecv == pp->codeproc) { + refclock_report(peer, CEVNT_TIMEOUT); + return; + } + refclock_receive(peer); } #else diff --git a/ntpd/refclock_atom.c b/ntpd/refclock_atom.c index 46a63129f8..9151633b7f 100644 --- a/ntpd/refclock_atom.c +++ b/ntpd/refclock_atom.c @@ -85,23 +85,15 @@ * Interface definitions */ #ifdef HAVE_PPSAPI /* avoid others if api available */ -#undef PPS -#undef TTYCLK - extern int pps_assert; #endif /* HAVE_PPSAPI */ - -#ifdef PPS /* avoid tty_clk if ppsclock available */ -#undef TTYCLK -#endif /* PPS */ - #ifdef TTYCLK -# define DEVICE "/dev/pps%d" /* device name and unit */ -# ifdef B38400 -# define SPEED232 B38400 /* uart speed (38400 baud) */ -# else -# define SPEED232 EXTB /* as above */ -# endif +#define DEVICE "/dev/pps%d" /* device name and unit */ +#ifdef B38400 +#define SPEED232 B38400 /* uart speed (38400 baud) */ +#else +#define SPEED232 EXTB /* as above */ +#endif #endif /* TTYCLK */ #define PRECISION (-20) /* precision assumed (about 1 us) */ @@ -112,9 +104,7 @@ extern int pps_assert; #define FLAG_PPS 0x02 /* ppsclock heard from */ #define FLAG_AUX 0x04 /* auxiliary PPS source */ -#ifdef PPS_SAMPLE static struct peer *pps_peer; /* atom driver for auxiliary PPS sources */ -#endif #ifdef TTYCLK static void atom_receive P((struct recvbuf *)); @@ -131,7 +121,6 @@ struct atomunit { struct ppsclockev ev; /* ppsclock control */ #endif /* PPS */ int flags; /* flags that wave */ - int pollcnt; /* poll message counter */ }; /* @@ -175,16 +164,19 @@ atom_start( char device[20]; #endif /* TTYCLK */ + pps_peer = peer; flags = 0; + #ifdef TTYCLK /* * Open serial port. Use LDISC_CLKPPS line discipline only * if the LDISC_PPS line discipline is not availble, */ - (void)sprintf(device, DEVICE, unit); - if ((fd = refclock_open(device, SPEED232, LDISC_CLKPPS)) == 0) - return (0); - flags |= FLAG_TTY; + if (fdpps <= 0) { + (void)sprintf(device, DEVICE, unit); + if ((fd = refclock_open(device, SPEED232, LDISC_CLKPPS)) != 0) + flags |= FLAG_TTY; + } #endif /* TTYCLK */ /* @@ -213,20 +205,14 @@ atom_start( } } #endif /* TTYCLK */ -#ifdef PPS_SAMPLE - if (pps_peer == 0) - pps_peer = peer; -#endif /* PPS_SAMPLE */ + /* * Initialize miscellaneous variables */ peer->precision = PRECISION; pp->clockdesc = DESCRIPTION; memcpy((char *)&pp->refid, REFID, 4); - up->pollcnt = 2; up->flags = flags; - pp->nstages = MAXSTAGE; - pp->nskeep = MAXSTAGE * 3 / 5; return (1); } @@ -249,10 +235,8 @@ atom_shutdown( if (up->flags & FLAG_TTY) io_closeclock(&pp->io); #endif /* TTYCLK */ -#ifdef PPS_SAMPLE if (pps_peer == peer) pps_peer = 0; -#endif /* PPS_SAMPLE */ free(up); } @@ -272,7 +256,7 @@ atom_pps( struct timespec ts; #else struct timeval ts; -#endif +#endif /* HAVE_TIMESPEC */ l_fp lftmp; double doffset; int i; @@ -327,9 +311,8 @@ atom_pps( L_CLR(&lftmp); L_ADDF(&lftmp, pp->lastrec.l_f); LFPTOD(&lftmp, doffset); - pp->filter[pp->coderecv++ % pp->nstages] = -doffset + + pp->filter[pp->coderecv++ % MAXSTAGE] = -doffset + pp->fudgetime1; - up->pollcnt = 2 * 60; return (0); } #endif /* PPS || HAVE_PPSAPI */ @@ -372,12 +355,10 @@ atom_receive( L_CLR(&lftmp); L_ADDF(&lftmp, pp->lastrec.l_f); LFPTOD(&lftmp, doffset); - pp->filter[pp->coderecv++ % pp->nstages] = -doffset + pp->fudgetime1; - up->pollcnt = 2; + pp->filter[pp->coderecv++ % MAXSTAGE] = -doffset + pp->fudgetime1; } #endif /* TTYCLK */ -#ifdef PPS_SAMPLE /* * pps_sample - receive PPS data from some other clock driver */ @@ -416,12 +397,10 @@ pps_sample( L_CLR(&lftmp); L_ADDF(&lftmp, pp->lastrec.l_f); LFPTOD(&lftmp, doffset); - pp->filter[pp->coderecv++ % pp->nstages] = -doffset + + pp->filter[pp->coderecv++ % MAXSTAGE] = -doffset + pp->fudgetime1; - up->pollcnt = 2 * 60; return (0); } -#endif /* PPS_SAMPLE */ /* * atom_poll - called by the transmit procedure @@ -447,15 +426,15 @@ atom_poll( if (atom_pps(peer)) return; } +#endif /* PPS || HAVE_PPSAPI */ if (peer->burst > 0) return; -#endif /* PPS || HAVE_PPSAPI */ - pp->polls++; - if (up->pollcnt == 0) { - refclock_report(peer, CEVNT_FAULT); + if (pp->coderecv == pp->codeproc) { + refclock_report(peer, CEVNT_TIMEOUT); return; } - up->pollcnt--; + peer->burst = NSTAGE; + pp->polls++; /* * Valid time (leap bits zero) is returned only if the prefer @@ -471,10 +450,8 @@ atom_poll( return; } pp->variance = 0; + record_clock_stats(&peer->srcadr, pp->a_lastcode); refclock_receive(peer); -#if defined(PPS) || defined(HAVE_PPSAPI) - peer->burst = pp->nstages; -#endif /* PPS || HAVE_PPSAPI */ } #else diff --git a/ntpd/refclock_chu.c b/ntpd/refclock_chu.c index efa2ff301a..0d82799df2 100644 --- a/ntpd/refclock_chu.c +++ b/ntpd/refclock_chu.c @@ -416,8 +416,6 @@ chu_start( */ peer->precision = PRECISION; pp->clockdesc = DESCRIPTION; - pp->nstages = MAXSTAGE; - pp->nskeep = MAXSTAGE * 3 / 5; memcpy((char *)&pp->refid, REFID, 4); DTOLFP(CHAR, &up->charstamp); up->pollcnt = 2; @@ -1256,8 +1254,8 @@ chu_poll( toffset = offset; L_SUB(&toffset, &up->tstamp[i]); LFPTOD(&toffset, dtemp); - pp->filter[(pp->coderecv++) % pp->nstages] = dtemp + - FUDGE + pp->fudgetime1; + pp->filter[pp->coderecv++ % MAXSTAGE] = dtemp + FUDGE + + pp->fudgetime1; } if (i > 0) refclock_receive(peer); diff --git a/ntpd/refclock_heath.c b/ntpd/refclock_heath.c index 57740f850a..aae05a752c 100644 --- a/ntpd/refclock_heath.c +++ b/ntpd/refclock_heath.c @@ -242,6 +242,7 @@ heath_start( * Initialize miscellaneous variables */ peer->precision = PRECISION; + peer->burst = NSTAGE; pp->clockdesc = DESCRIPTION; memcpy((char *)&pp->refid, REFID, 4); up->pollcnt = 2; @@ -302,7 +303,6 @@ heath_receive( */ pp->lastrec = up->tstamp; up->pollcnt = 2; - record_clock_stats(&peer->srcadr, pp->a_lastcode); #ifdef DEBUG if (debug) printf("heath: timecode %d %s\n", pp->lencode, @@ -432,11 +432,8 @@ heath_receive( pp->msec = (dsec - '0') * 100; pp->leap = LEAP_NOWARNING; } - if (!refclock_process(pp)) { + if (!refclock_process(pp)) refclock_report(peer, CEVNT_BADTIME); - return; - } - refclock_receive(peer); } @@ -460,10 +457,6 @@ heath_poll( */ pp = peer->procptr; up = (struct heathunit *)pp->unitptr; - if (up->pollcnt == 0) - refclock_report(peer, CEVNT_TIMEOUT); - else - up->pollcnt--; pp->polls++; /* @@ -475,10 +468,18 @@ heath_poll( * pulse might get too short. Later. */ if (ioctl(pp->io.fd, TIOCMBIC, (char *)&bits) < 0) - refclock_report(peer, CEVNT_FAULT); + refclock_report(peer, CEVNT_FAULT); get_systime(&up->tstamp); ioctl(pp->io.fd, TIOCMBIS, (char *)&bits); - + if (peer->burst > 0) + return; + peer->burst = NSTAGE; + if (pp->coderecv == pp->codeproc) { + refclock_report(peer, CEVNT_TIMEOUT); + return; + } + record_clock_stats(&peer->srcadr, pp->a_lastcode); + refclock_receive(peer); } #else diff --git a/ntpd/refclock_irig.c b/ntpd/refclock_irig.c index d8b92e8fd9..06f9dbbab1 100644 --- a/ntpd/refclock_irig.c +++ b/ntpd/refclock_irig.c @@ -359,8 +359,6 @@ irig_start( up->tc = MINTC; up->decim = 1; up->fdelay = IRIG_B; - pp->nstages = 50; - pp->nskeep = 30; up->gain = (AUDIO_MAX_GAIN - AUDIO_MIN_GAIN) / 2; if (irig_audio() < 0) { io_closeclock(&pp->io); @@ -485,13 +483,9 @@ irig_receive( if (up->irig_b > up->irig_e) { up->decim = 1; up->fdelay = IRIG_B; - pp->nstages = 50; - pp->nskeep = 30; } else { up->decim = 10; up->fdelay = IRIG_E; - pp->nstages = 5; - pp->nskeep = 3; } if (pp->sloppyclockflag & CLK_FLAG2) up->port = AUDIO_LINE_IN; @@ -850,7 +844,7 @@ irig_decode( up->timecnt++; refclock_process(pp); } - if (up->timecnt >= pp->nstages) { + if (up->timecnt >= MAXSTAGE) { refclock_receive(peer); up->timecnt = 0; up->pollcnt = 2; diff --git a/ntpd/refclock_jupiter.c b/ntpd/refclock_jupiter.c index be41b91426..f22714bdf7 100644 --- a/ntpd/refclock_jupiter.c +++ b/ntpd/refclock_jupiter.c @@ -708,7 +708,6 @@ jupiter_process(register struct peer *peer) */ pp->lastref = up->lastref; pp->coderecv = up->coderecv; - pp->nstages = up->nkeep + 2; pp->filter[0] = off[0]; /* smallest offset */ pp->filter[1] = off[NSAMPLES-1]; /* largest offset */ for (j = 2, k = i; k < n; j++, k++) diff --git a/ntpd/refclock_msfees.c b/ntpd/refclock_msfees.c index 1cfe47f9db..0c46718483 100644 --- a/ntpd/refclock_msfees.c +++ b/ntpd/refclock_msfees.c @@ -556,7 +556,6 @@ msfees_start( unitinuse[unit] = 1; pp->unitptr = (caddr_t) &eesunits[unit]; pp->clockdesc = EESDESCRIPTION; - pp->nstages = MAXSTAGE; msyslog(LOG_ERR, "ees clock: %s OK on %d", eesdev, unit); return (1); diff --git a/ntpd/refclock_mx4200.c b/ntpd/refclock_mx4200.c index b90ee6f6f6..59660c4e0e 100644 --- a/ntpd/refclock_mx4200.c +++ b/ntpd/refclock_mx4200.c @@ -326,8 +326,6 @@ mx4200_config( up->last_leap = 0; /* LEAP_NOWARNING */ up->clamp_time = current_time + (AVGING_TIME * 60 * 60); up->log_time = current_time + SLEEPTIME; - pp->nstages = MNSAMPLES; - pp->nskeep = MNKEEP; /* * "007" Control Port Configuration diff --git a/ntpd/refclock_oncore.c b/ntpd/refclock_oncore.c index 2cba7eb7df..f8f9eaeb5e 100644 --- a/ntpd/refclock_oncore.c +++ b/ntpd/refclock_oncore.c @@ -429,9 +429,6 @@ oncore_start( } memset((char *) instance, 0, sizeof *instance); pp = peer->procptr; - pp->nstages = 16; - pp->nskeep = pp->nstages * 3 / 5; - pp->unitptr = (caddr_t)instance; instance->unit = unit; instance->ttyfd = fd1; diff --git a/ntpd/refclock_palisade.c b/ntpd/refclock_palisade.c index 9042b9f010..fe6f3a762a 100644 --- a/ntpd/refclock_palisade.c +++ b/ntpd/refclock_palisade.c @@ -199,11 +199,6 @@ palisade_start ( pp->io.srcclock = (caddr_t)peer; pp->io.datalen = 0; pp->io.fd = fd; - pp->nstages = 1; -#ifndef PALISADE - pp->nskeep = 1; -#endif - if (!io_addclock(&pp->io)) { #ifdef DEBUG printf("Palisade(%d) io_addclock\n",unit); diff --git a/ntpd/refclock_parse.c b/ntpd/refclock_parse.c index 3f033ac2e9..14b9e7d610 100644 --- a/ntpd/refclock_parse.c +++ b/ntpd/refclock_parse.c @@ -3487,12 +3487,7 @@ parse_process( } #endif - if (!refclock_process_offset(parse->generic, reftime, rectime, fudge)) - { - parse_event(parse, CEVNT_BADTIME); - return; - } - + refclock_process_offset(parse->generic, reftime, rectime, fudge); if (PARSE_PPS(parsetime->parse_state) && CLK_PPS(parse->peer)) { (void) pps_sample(&parse->time.parse_ptime.fp); diff --git a/ntpd/refclock_pst.c b/ntpd/refclock_pst.c index 2ef4e449b0..919bd948bb 100644 --- a/ntpd/refclock_pst.c +++ b/ntpd/refclock_pst.c @@ -156,8 +156,7 @@ pst_start( * Initialize miscellaneous variables */ peer->precision = PRECISION; - peer->flags |= FLAG_BURST; - peer->burst = pp->nstages; + peer->burst = NSTAGE; pp->clockdesc = DESCRIPTION; memcpy((char *)&pp->refid, WWVREFID, 4); return (1); @@ -250,19 +249,6 @@ pst_receive( return; } - /* - * Process the new sample in the median filter and determine the - * timecode timestamp. - */ - if (!refclock_process(pp)) { - refclock_report(peer, CEVNT_BADTIME); - peer->burst = 0; - return; - } - if (peer->burst > 0) - return; - record_clock_stats(&peer->srcadr, pp->a_lastcode); - /* * Decode synchronization, quality and last update. If * unsynchronized, set the leap bits accordingly and exit. Once @@ -279,7 +265,14 @@ pst_receive( if (peer->stratum <= 1) peer->refid = pp->refid; pp->disp = PST_PHI * ltemp; - refclock_receive(peer); + + /* + * Process the new sample in the median filter and determine the + * timecode timestamp. + */ + if (!refclock_process(pp)) + refclock_report(peer, CEVNT_BADTIME); + } @@ -303,14 +296,21 @@ pst_poll( */ pp = peer->procptr; up = (struct pstunit *)pp->unitptr; - if (peer->burst ==0 && peer->reach == 0) - refclock_report(peer, CEVNT_TIMEOUT); up->tcswitch = 0; up->lastptr = pp->a_lastcode; if (write(pp->io.fd, "QTQDQMT", 6) != 6) refclock_report(peer, CEVNT_FAULT); else pp->polls++; + if (peer->burst > 0) + return; + peer->burst = NSTAGE; + if (pp->coderecv == pp->codeproc) { + refclock_report(peer, CEVNT_TIMEOUT); + return; + } + record_clock_stats(&peer->srcadr, pp->a_lastcode); + refclock_receive(peer); } #else diff --git a/ntpd/refclock_tpro.c b/ntpd/refclock_tpro.c index 5d750e1bc3..55c594ce4f 100644 --- a/ntpd/refclock_tpro.c +++ b/ntpd/refclock_tpro.c @@ -104,8 +104,7 @@ tpro_start( * Initialize miscellaneous peer variables */ peer->precision = PRECISION; - peer->flags |= FLAG_BURST; - peer->burst = pp->nstages; + peer->burst = pp->NSTAGE; pp->clockdesc = DESCRIPTION; memcpy((char *)&pp->refid, REFID, 4); return (1); @@ -186,6 +185,10 @@ tpro_poll( refclock_report(peer, CEVNT_BADTIME); return; } + if (!tp->status & 0x3) + pp->leap = LEAP_NOTINSYNC; + else + pp->leap = LEAP_NOWARNING; if (!refclock_process(pp)) { refclock_report(peer, CEVNT_BADTIME); peer->burst = 0; @@ -193,11 +196,12 @@ tpro_poll( } if (peer->burst > 0) return; + peer->burst = NSTAGE; + if (pp->coderecv == pp->codeproc) { + refclock_report(peer, CEVNT_TIMEOUT); + return; + } record_clock_stats(&peer->srcadr, pp->a_lastcode); - if (!tp->status & 0x3) - pp->leap = LEAP_NOTINSYNC; - else - pp->leap = LEAP_NOWARNING; refclock_receive(peer); } diff --git a/ntpd/refclock_ulink.c b/ntpd/refclock_ulink.c index d4676f65d3..0b7bd8206b 100644 --- a/ntpd/refclock_ulink.c +++ b/ntpd/refclock_ulink.c @@ -153,7 +153,7 @@ ulink_start( */ peer->precision = PRECISION; peer->flags |= FLAG_BURST; - peer->burst = pp->nstages; + peer->burst = NSTAGE; pp->clockdesc = DESCRIPTION; memcpy((char *)&pp->refid, REFID, 4); return (1); @@ -252,23 +252,8 @@ ulink_receive( &syncchar, &qualchar, &modechar, &pp->year, &pp->day, &leapchar,&pp->hour, &pp->minute, &pp->second,&pp->msec); - pp->msec*=10; /* M320 returns 10's of msecs */ - - /* - * Process the new sample in the median filter and determine the - * timecode timestamp. - */ - if (!refclock_process(pp)) { - refclock_report(peer, CEVNT_BADTIME); - peer->burst = 0; - return; - } - if (peer->burst > 0) - return; - - record_clock_stats(&peer->srcadr, pp->a_lastcode); - - qualchar=' '; + pp->msec *= 10; /* M320 returns 10's of msecs */ + qualchar = ' '; /* * Decode synchronization, quality and leap characters. If @@ -278,18 +263,14 @@ ulink_receive( * quality character. */ pp->disp = .001; - pp->leap = LEAP_NOWARNING; - refclock_receive(peer); /* - * If the monitor flag is set (flag4), we dump the internal - * quality table at the first timecode beginning the day. + * Process the new sample in the median filter and determine the + * timecode timestamp. */ - if (pp->sloppyclockflag & CLK_FLAG4 && pp->hour < - (int)up->lasthour) - up->linect = MONLIN; - up->lasthour = pp->hour; + if (!refclock_process(pp)) + refclock_report(peer, CEVNT_BADTIME); } @@ -302,13 +283,35 @@ ulink_poll( struct peer *peer ) { + register struct ulinkunit *up; struct refclockproc *pp; char pollchar; pp = peer->procptr; + up = (struct wwvbunit *)pp->unitptr; pollchar = 'T'; - write(pp->io.fd, &pollchar, 1); - pp->polls++; + if (write(pp->io.fd, &pollchar, 1) != 1) + refclock_report(peer, CEVNT_FAULT); + else + pp->polls++; + if (peer->burst > 0) + return; + peer->burst = NSTAGE; + if (pp->coderecv == pp->codeproc) { + refclock_report(peer, CEVNT_TIMEOUT); + return; + } + record_clock_stats(&peer->srcadr, pp->a_lastcode); + refclock_receive(peer); + + /* + * If the monitor flag is set (flag4), we dump the internal + * quality table at the first timecode beginning the day. + */ + if (pp->sloppyclockflag & CLK_FLAG4 && pp->hour < + (int)up->lasthour) + up->linect = MONLIN; + up->lasthour = pp->hour; } #else diff --git a/ntpd/refclock_usno.c b/ntpd/refclock_usno.c index 1fdef6843e..cf404e74d2 100644 --- a/ntpd/refclock_usno.c +++ b/ntpd/refclock_usno.c @@ -327,8 +327,6 @@ usno_receive( * dispersion. The fudge time1 value is added to each sample as * received. */ - pp->nstages = up->msgcnt; - pp->nskeep = up->msgcnt * 2 / 3; if (!refclock_process(pp)) { #ifdef DEBUG if (debug) diff --git a/ntpd/refclock_wwvb.c b/ntpd/refclock_wwvb.c index ad5711d07b..568e01762e 100644 --- a/ntpd/refclock_wwvb.c +++ b/ntpd/refclock_wwvb.c @@ -21,22 +21,27 @@ /* * This driver supports the Spectracom Model 8170 and Netclock/2 WWVB - * Synchronized Clock. This clock has proven a reliable source of time, - * except in some cases of high ambient conductive RF interference. The - * claimed accuracy of the clock is 100 usec relative to the broadcast - * signal; however, in most cases the actual accuracy is limited by the - * precision of the timecode and the latencies of the serial interface - * and operating system. + * Synchronized Clocks and the Netclock/GPS Master Clock. Both the WWVB + * and GPS clocks have proven reliable sources of time; however, the + * WWVB clocks have proven vulnerable to high ambient conductive RF + * interference. The claimed accuracy of the WWVB clocks is 100 us + * relative to the broadcast signal, while the claimed accuracy of the + * GPS clock is 50 ns; however, in most cases the actual accuracy is + * limited by the resolution of the timecode and the latencies of the + * serial interface and operating system. * - * The DIPswitches on this clock should be set to 24-hour display, AUTO - * DST off, time zone 0 (UTC), data format 0 or 2 (see below) and baud - * rate 9600. If this clock is to used as the source for the IRIG Audio - * Decoder (refclock_irig.c in this distribution), set the DIPswitches - * for AM IRIG output and IRIG format 1 (IRIG B with signature control). + * The WWVB and GPS clocks should be configured for 24-hour display, + * AUTO DST off, time zone 0 (UTC), data format 0 or 2 (see below) and + * baud rate 9600. If the clock is to used as the source for the IRIG + * Audio Decoder (refclock_irig.c in this distribution), it should be + * configured for AM IRIG output and IRIG format 1 (IRIG B with + * signature control). The GPS clock can be configured either to respond + * to a 'T' poll character or left running continuously. * * There are two timecode formats used by these clocks. Format 0, which * is available with both the Netclock/2 and 8170, and format 2, which - * is available only with the Netclock/2 and specially modified 8170. + * is available only with the Netclock/2, specially modified 8170 and + * GPS. * * Format 0 (22 ASCII printing characters): * @@ -46,7 +51,7 @@ * hh:mm:ss = hours, minutes, seconds * i = synchronization flag (' ' = in synch, '?' = out of synch) * - * The alarm condition is indicated by other than ' ' at A, which occurs + * The alarm condition is indicated by other than ' ' at a, which occurs * during initial synchronization and when received signal is lost for * about ten hours. * @@ -61,32 +66,30 @@ * ddd = day of year * hh:mm:ss.fff = hours, minutes, seconds, milliseconds * - * The alarm condition is indicated by other than ' ' at A, which occurs + * The alarm condition is indicated by other than ' ' at a, which occurs * during initial synchronization and when received signal is lost for * about ten hours. The unlock condition is indicated by other than ' ' - * at Q. + * at q. * - * The Q is normally ' ' when the time error is less than 1 ms and a + * The q is normally ' ' when the time error is less than 1 ms and a * character in the set 'A'...'D' when the time error is less than 10, - * 100, 500 and greater than 500 ms respectively. The L is normally ' ', + * 100, 500 and greater than 500 ms respectively. The l is normally ' ', * but is set to 'L' early in the month of an upcoming UTC leap second - * and reset to ' ' on the first day of the following month. The D is + * and reset to ' ' on the first day of the following month. The d is * set to 'S' for standard time 'I' on the day preceding a switch to * daylight time, 'D' for daylight time and 'O' on the day preceding a * switch to standard time. The start bit of the first is * synchronized to the indicated time as returned. * * This driver does not need to be told which format is in use - it - * figures out which one from the length of the message. A three-stage - * median filter is used to reduce jitter and provide a dispersion - * measure. The driver makes no attempt to correct for the intrinsic - * jitter of the radio itself, which is a known problem with the older - * radios. + * figures out which one from the length of the message.The driver makes + * no attempt to correct for the intrinsic jitter of the radio itself, + * which is a known problem with the older radios. * * Fudge Factors * * This driver can retrieve a table of quality data maintained - * internally by the Netclock/2 receiver. If flag4 of the fudge + * internally by the Netclock/2 clock. If flag4 of the fudge * configuration command is set to 1, the driver will retrieve this * table and write it to the clockstats file on when the first timecode * message of a new day is received. @@ -99,7 +102,7 @@ #define SPEED232 B9600 /* uart speed (9600 baud) */ #define PRECISION (-13) /* precision assumed (about 100 us) */ #define REFID "WWVB" /* reference ID */ -#define DESCRIPTION "Spectracom WWVB Receiver" /* WRU */ +#define DESCRIPTION "Spectracom WWVB/GPS Receivers" /* WRU */ #define LENWWVB0 22 /* format 0 timecode length */ #define LENWWVB2 24 /* format 2 timecode length */ @@ -184,8 +187,7 @@ wwvb_start( * Initialize miscellaneous variables */ peer->precision = PRECISION; - peer->flags |= FLAG_BURST; - peer->burst = pp->nstages; + peer->burst = NSTAGE; pp->clockdesc = DESCRIPTION; memcpy((char *)&pp->refid, REFID, 4); return (1); @@ -224,13 +226,13 @@ wwvb_receive( struct peer *peer; l_fp trtmp; /* arrival timestamp */ + int tz; /* time zone */ + int day, month; /* ddd conversion */ + int temp; /* int temp */ char syncchar; /* synchronization indicator */ char qualchar; /* quality indicator */ char leapchar; /* leap indicator */ char dstchar; /* daylight/standard indicator */ - int tz; /* time zone */ - int day, month; /* ddd conversion */ - int temp; /* int temp */ /* * Initialize pointers and read the timecode and timestamp @@ -271,9 +273,8 @@ wwvb_receive( /* * We get down to business, check the timecode format and decode * its contents. This code uses the timecode length to determine - * whether format 0 or format 2. If the timecode has invalid - * length or is not in proper format, we declare bad format and - * exit. + * format 0, 2 or 3. If the timecode has invalid length or is + * not in proper format, we declare bad format and exit. */ syncchar = qualchar = leapchar = dstchar = ' '; tz = 0; @@ -285,7 +286,8 @@ wwvb_receive( /* * Timecode format 0: "I ddd hh:mm:ss DTZ=nn" */ - if (sscanf(pp->a_lastcode, "%c %3d %2d:%2d:%2d %cTZ=%2d", + if (sscanf(pp->a_lastcode, + "%c %3d %2d:%2d:%2d %cTZ=%2d", &syncchar, &pp->day, &pp->hour, &pp->minute, &pp->second, &dstchar, &tz) == 7) break; @@ -295,7 +297,8 @@ wwvb_receive( /* * Timecode format 2: "IQyy ddd hh:mm:ss.mmm LD" */ - if (sscanf(pp->a_lastcode, "%c%c %2d %3d %2d:%2d:%2d.%3d %c", + if (sscanf(pp->a_lastcode, + "%c%c %2d %3d %2d:%2d:%2d.%3d %c", &syncchar, &qualchar, &pp->year, &pp->day, &pp->hour, &pp->minute, &pp->second, &pp->msec, &leapchar) == 9) @@ -309,34 +312,28 @@ wwvb_receive( if (sscanf(pp->a_lastcode, "0003%c %4d%2d%2d %2d%2d%2d+0000%c%c", &syncchar, &pp->year, &month, &day, &pp->hour, - &pp->minute, &pp->second, &dstchar, &leapchar) == 8) { + &pp->minute, &pp->second, &dstchar, &leapchar) == 8) + { pp->day = ymd2yd(pp->year, month, day); break; } default: - if (up->linect > 0) + /* + * Unknown format: If dumping internal table, record + * stats; otherwise, declare bad format. + */ + if (up->linect > 0) { up->linect--; - else + record_clock_stats(&peer->srcadr, + pp->a_lastcode); + } else { refclock_report(peer, CEVNT_BADREPLY); + } return; } - /* - * Process the new sample in the median filter and determine the - * timecode timestamp. - */ - if (!refclock_process(pp)) { - refclock_report(peer, CEVNT_BADTIME); - peer->burst = 0; - return; - } - if (peer->burst > 0) - return; - - record_clock_stats(&peer->srcadr, pp->a_lastcode); - /* * Decode synchronization, quality and leap characters. If * unsynchronized, set the leap bits accordingly and exit. @@ -377,16 +374,13 @@ wwvb_receive( pp->leap = LEAP_ADDSECOND; else pp->leap = LEAP_NOWARNING; - refclock_receive(peer); /* - * If the monitor flag is set (flag4), we dump the internal - * quality table at the first timecode beginning the day. + * Process the new sample in the median filter and determine the + * timecode timestamp. */ - if (pp->sloppyclockflag & CLK_FLAG4 && pp->hour < - (int)up->lasthour) - up->linect = MONLIN; - up->lasthour = pp->hour; + if (!refclock_process(pp)) + refclock_report(peer, CEVNT_BADTIME); } @@ -401,21 +395,18 @@ wwvb_poll( { register struct wwvbunit *up; struct refclockproc *pp; - char pollchar; + char pollchar; /* character sent to clock */ /* * Time to poll the clock. The Spectracom clock responds to a * 'T' by returning a timecode in the format(s) specified above. * Note there is no checking on state, since this may not be the * only customer reading the clock. Only one customer need poll - * the clock; all others just listen in. If nothing is heard - * from the clock for two polls, declare a timeout and keep - * going. + * the clock; all others just listen in. If the clock becomes + * unreachable, declare a timeout and keep going. */ pp = peer->procptr; up = (struct wwvbunit *)pp->unitptr; - if (peer->burst == 0 && peer->reach == 0) - refclock_report(peer, CEVNT_TIMEOUT); if (up->linect > 0) pollchar = 'R'; else @@ -424,6 +415,24 @@ wwvb_poll( refclock_report(peer, CEVNT_FAULT); else pp->polls++; + if (peer->burst > 0) + return; + peer->burst = NSTAGE; + if (pp->coderecv == pp->codeproc) { + refclock_report(peer, CEVNT_TIMEOUT); + return; + } + record_clock_stats(&peer->srcadr, pp->a_lastcode); + refclock_receive(peer); + + /* + * If the monitor flag is set (flag4), we dump the internal + * quality table at the first timecode beginning the day. + */ + if (pp->sloppyclockflag & CLK_FLAG4 && pp->hour < + (int)up->lasthour) + up->linect = MONLIN; + up->lasthour = pp->hour; } #else diff --git a/ntpd/status b/ntpd/status deleted file mode 100644 index bda6fc6cb6..0000000000 --- a/ntpd/status +++ /dev/null @@ -1,32 +0,0 @@ -ntp_request.c: ik->offset = htonl((u_int32)ntx.offset); -ntp_request.c: ik->freq = htonl((u_int32)ntx.freq); -ntp_request.c: ik->maxerror = htonl((u_int32)ntx.maxerror); -ntp_request.c: ik->esterror = htonl((u_int32)ntx.esterror); -ntp_request.c: ik->status = htons(ntx.status); -ntp_request.c: ik->constant = htonl((u_int32)ntx.constant); -ntp_request.c: ik->precision = htonl((u_int32)ntx.precision); -ntp_request.c: ik->tolerance = htonl((u_int32)ntx.tolerance); -ntp_request.c: ik->ppsfreq = htonl((u_int32)ntx.ppsfreq); -ntp_request.c: ik->jitter = htonl((u_int32)ntx.jitter); -ntp_request.c: ik->shift = htons(ntx.shift); -ntp_request.c: ik->stabil = htonl((u_int32)ntx.stabil); -ntp_request.c: ik->jitcnt = htonl((u_int32)ntx.jitcnt); -ntp_request.c: ik->calcnt = htonl((u_int32)ntx.calcnt); -ntp_request.c: ik->errcnt = htonl((u_int32)ntx.errcnt); -ntp_request.c: ik->stbcnt = htonl((u_int32)ntx.stbcnt); -ntp_request.c~: ik->offset = htonl((u_int32)ntx.offset); -ntp_request.c~: ik->freq = htonl((u_int32)ntx.freq); -ntp_request.c~: ik->maxerror = htonl((u_int32)ntx.maxerror); -ntp_request.c~: ik->esterror = htonl((u_int32)ntx.esterror); -ntp_request.c~: ik->status = htons(ntx.status); -ntp_request.c~: ik->constant = htonl((u_int32)ntx.constant); -ntp_request.c~: ik->precision = htonl((u_int32)ntx.precision); -ntp_request.c~: ik->tolerance = htonl((u_int32)ntx.tolerance); -ntp_request.c~: ik->ppsfreq = htonl((u_int32)ntx.ppsfreq); -ntp_request.c~: ik->jitter = htonl((u_int32)ntx.jitter); -ntp_request.c~: ik->shift = htons(ntx.shift); -ntp_request.c~: ik->stabil = htonl((u_int32)ntx.stabil); -ntp_request.c~: ik->jitcnt = htonl((u_int32)ntx.jitcnt); -ntp_request.c~: ik->calcnt = htonl((u_int32)ntx.calcnt); -ntp_request.c~: ik->errcnt = htonl((u_int32)ntx.errcnt); -ntp_request.c~: ik->stbcnt = htonl((u_int32)ntx.stbcnt);