summaryrefslogtreecommitdiff
path: root/ntpd/refclock_msfees.c
diff options
context:
space:
mode:
Diffstat (limited to 'ntpd/refclock_msfees.c')
-rw-r--r--ntpd/refclock_msfees.c47
1 files changed, 14 insertions, 33 deletions
diff --git a/ntpd/refclock_msfees.c b/ntpd/refclock_msfees.c
index 1b25c1c38c4e..8399c96e78ab 100644
--- a/ntpd/refclock_msfees.c
+++ b/ntpd/refclock_msfees.c
@@ -4,6 +4,8 @@
#include <config.h>
#endif
+#include "ntp_types.h"
+
#if defined(REFCLOCK) && defined(CLOCK_MSFEES) && defined(PPS)
/* Currently REQUIRES STREAM and PPSCD. CLK and CBREAK modes
@@ -14,8 +16,7 @@
#include "ntpd.h"
#include "ntp_io.h"
#include "ntp_refclock.h"
-#include "ntp_unixtime.h"
-#include "ntp_calendar.h"
+#include "timevalops.h"
#include <ctype.h>
#if defined(HAVE_BSD_TTYS)
@@ -349,11 +350,7 @@ static void dump_buf P((l_fp *coffs, int from, int to, char *text));
static void ees_report_event P((struct eesunit *ees, int code));
static void ees_receive P((struct recvbuf *rbufp));
static void ees_process P((struct eesunit *ees));
-#ifdef QSORT_USES_VOID_P
static int offcompare P((const void *va, const void *vb));
-#else
-static int offcompare P((const l_fp *a, const l_fp *b));
-#endif /* QSORT_USES_VOID_P */
/*
@@ -537,7 +534,7 @@ msfees_start(
ees->timestarted= current_time;
ees->ttytype = 0;
ees->io.clock_recv= ees_receive;
- ees->io.srcclock= (caddr_t)ees;
+ ees->io.srcclock= peer;
ees->io.datalen = 0;
ees->io.fd = fd232;
@@ -589,7 +586,7 @@ msfees_start(
peer->refid = htonl(EESHSREFID);
}
unitinuse[unit] = 1;
- pp->unitptr = (caddr_t) &eesunits[unit];
+ pp->unitptr = &eesunits[unit];
pp->clockdesc = EESDESCRIPTION;
msyslog(LOG_ERR, "ees clock: %s OK on %d", eesdev, unit);
return (1);
@@ -677,7 +674,7 @@ ees_receive(
#endif
/* Get the clock this applies to and a pointer to the data */
- ees = (struct eesunit *)rbufp->recv_srcclock;
+ ees = (struct eesunit *)rbufp->recv_peer->procptr->unitptr;
dpt = (u_char *)&rbufp->recv_space;
dpend = dpt + rbufp->recv_length;
if ((dbg & DB_LOG_AWAITMORE) && (rbufp->recv_length != LENEESCODE))
@@ -921,9 +918,9 @@ ees_receive(
if (pps_step != 1 && pps_step != 2)
fprintf(stderr, "PPS step: %d too far off %ld (%d)\n",
ppsclockev.serial, ees->last_pps_no, pps_step);
- else if (!buftvtots((char *) &(ppsclockev.tv), &pps_arrvstamp))
- fprintf(stderr, "buftvtots failed\n");
- else { /* if ((ABS(time difference) - 0.25) < 0)
+ else {
+ pps_arrvstamp = tval_stamp_to_lfp(ppsclockev.tv);
+ /* if ((ABS(time difference) - 0.25) < 0)
* then believe it ...
*/
l_fp diff;
@@ -1227,7 +1224,6 @@ ees_receive(
/* offcompare - auxiliary comparison routine for offset sort */
-#ifdef QSORT_USES_VOID_P
static int
offcompare(
const void *va,
@@ -1238,16 +1234,6 @@ offcompare(
const l_fp *b = (const l_fp *)vb;
return(L_ISGEQ(a, b) ? (L_ISEQU(a, b) ? 0 : 1) : -1);
}
-#else
-static int
-offcompare(
- const l_fp *a,
- const l_fp *b
- )
-{
- return(L_ISGEQ(a, b) ? (L_ISEQU(a, b) ? 0 : 1) : -1);
-}
-#endif /* QSORT_USES_VOID_P */
/* ees_process - process a pile of samples from the clock */
@@ -1289,16 +1275,11 @@ ees_process(
if (samples < 1) return;
/* If requested, dump the raw data we have in the buffer */
- if (ees->dump_vals) dump_buf(coffs, 0, samples, "Raw data is:");
+ if (ees->dump_vals)
+ dump_buf(coffs, 0, samples, "Raw data is:");
/* Sort the offsets, trim off the extremes, then choose one. */
- qsort(
-#ifdef QSORT_USES_VOID_P
- (void *)
-#else
- (char *)
-#endif
- coffs, (size_t)samples, sizeof(l_fp), offcompare);
+ qsort(coffs, (size_t)samples, sizeof(coffs[0]), offcompare);
noff = samples;
i = 0;
@@ -1430,7 +1411,7 @@ ees_process(
* reference time, and lastsampletime as the receive time.
*/
if (ees->fix_pending) {
- msyslog(LOG_ERR, "MSF%d: fix_pending=%d -> jump %x.%08x\n",
+ msyslog(LOG_ERR, "MSF%d: fix_pending=%d -> jump %x.%08x",
ees->fix_pending, ees->unit, offset.l_i, offset.l_f);
ees->fix_pending = 0;
}
@@ -1465,5 +1446,5 @@ msfees_poll(
#else
-int refclock_msfees_bs;
+NONEMPTY_TRANSLATION_UNIT
#endif /* REFCLOCK */