diff options
Diffstat (limited to 'contrib/ntp/ntpd/refclock_datum.c')
-rw-r--r-- | contrib/ntp/ntpd/refclock_datum.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/contrib/ntp/ntpd/refclock_datum.c b/contrib/ntp/ntpd/refclock_datum.c index 74a37db..db03c95 100644 --- a/contrib/ntp/ntpd/refclock_datum.c +++ b/contrib/ntp/ntpd/refclock_datum.c @@ -17,16 +17,15 @@ ** Include Files */ -#include <stdio.h> -#include <ctype.h> -#include <sys/time.h> - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" #include "ntp_unixtime.h" #include "ntp_stdlib.h" +#include <stdio.h> +#include <ctype.h> + #if defined(HAVE_BSD_TTYS) #include <sgtty.h> #endif /* HAVE_BSD_TTYS */ @@ -45,10 +44,6 @@ #endif /* WWVBCLK */ #endif /* STREAM */ -#if defined (WWVBPPS) -#include <sys/ppsclock.h> -#endif /* WWVBPPS */ - #include "ntp_stdlib.h" /* @@ -120,8 +115,8 @@ */ -#define PTSPRECISION (-10) /* precision assumed 1/1024 ms */ -#define DATMREFID "DATM" /* reference id */ +#define PRECISION (-10) /* precision assumed 1/1024 ms */ +#define REFID "DATM" /* reference id */ #define DATUM_DISPERSION 0 /* fixed dispersion = 0 ms */ #define DATUM_MAX_ERROR 0.100 /* limits on sigma squared */ @@ -238,7 +233,6 @@ datum_pts_start( { struct datum_pts_unit **temp_datum_pts_unit; struct datum_pts_unit *datum_pts; - #ifdef HAVE_TERMIOS struct termios arg; #endif @@ -304,6 +298,10 @@ datum_pts_start( msyslog(LOG_ERR, "Datum_PTS: Termios not supported in this driver"); (void)close(datum_pts->PTS_fd); + peer->precision = PRECISION; + pp->clockdesc = DESCRIPTION; + memcpy((char *)&pp->refid, REFID, 4); + return 0; #endif @@ -331,10 +329,6 @@ datum_pts_start( return 0; } - peer->precision = PTSPRECISION; - peer->stratum = 0; - memcpy((char *)&peer->refid, DATMREFID, 4); - /* ** Now add one to the number of units and return a successful code */ @@ -438,7 +432,7 @@ datum_pts_poll( ) { int i; - int index; + int unit_index; int error_code; struct datum_pts_unit *datum_pts; @@ -451,10 +445,10 @@ datum_pts_poll( ** Find the right unit and send out a time request once it is found. */ - index = -1; + unit_index = -1; for (i=0; i<nunits; i++) { if (datum_pts_unit[i]->unit == unit) { - index = i; + unit_index = i; datum_pts = datum_pts_unit[i]; error_code = write(datum_pts->PTS_fd, TIME_REQUEST, 6); if (error_code != 6) perror("TIME_REQUEST"); @@ -467,7 +461,7 @@ datum_pts_poll( ** Print out an error message if we could not find the right unit. */ - if (index == -1) { + if (unit_index == -1) { #ifdef DEBUG_DATUM_PTC if (debug) |