diff options
Diffstat (limited to 'contrib/ntp/ntpd/refclock_mx4200.c')
-rw-r--r-- | contrib/ntp/ntpd/refclock_mx4200.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/contrib/ntp/ntpd/refclock_mx4200.c b/contrib/ntp/ntpd/refclock_mx4200.c index 3c520b0..bc694ad 100644 --- a/contrib/ntp/ntpd/refclock_mx4200.c +++ b/contrib/ntp/ntpd/refclock_mx4200.c @@ -67,6 +67,8 @@ # include <sys/ppsclock.h> #endif +#include "ntp_sprintf.h" + #ifndef HAVE_STRUCT_PPSCLOCKEV struct ppsclockev { # ifdef HAVE_STRUCT_TIMESPEC @@ -892,7 +894,7 @@ mx4200_receive( mx4200_debug(peer, "%4d-%03d %02d:%02d:%02d at %s, %.6f\n", pp->year, pp->day, pp->hour, pp->minute, pp->second, prettydate(&pp->lastrec), pp->offset); - + pp->lastref = pp->lastrec; refclock_receive(peer); /* @@ -947,7 +949,7 @@ mx4200_receive( * 10 int User Time Bias: Operator specified bias, in nanoseconds * 11 int Leap Second Flag: Indicates that a leap second will * occur. This value is usually zero, except during - * the week prior to the leap second occurence, when + * the week prior to the leap second occurrence, when * this value will be set to +1 or -1. A value of * +1 indicates that GPS time will be 1 second * further ahead of UTC time. @@ -1103,8 +1105,6 @@ mx4200_parse_t( pp->hour = hour; pp->minute = minute; pp->second = second; - pp->msec = 0; - pp->usec = 0; /* * Toss if sentence is marked invalid @@ -1636,25 +1636,11 @@ mx4200_send(peer, fmt, va_alist) cp = buf; *cp++ = '$'; -#ifdef notdef - /* BSD is rational */ - n = vsnprintf(cp, sizeof(buf) - 1, fmt, ap); -#else - /* SunOS sucks */ - (void)vsprintf(cp, fmt, ap); - n = strlen(cp); -#endif /* notdef */ + n = VSNPRINTF((cp, sizeof(buf) - 1, fmt, ap)); ck = mx4200_cksum(cp, n); cp += n; ++n; -#ifdef notdef - /* BSD is rational */ - n += snprintf(cp, sizeof(buf) - n - 5, "*%02X\r\n", ck); -#else - /* SunOS sucks */ - sprintf(cp, "*%02X\r\n", ck); - n += strlen(cp); -#endif /* notdef */ + n += SNPRINTF((cp, sizeof(buf) - n - 5, "*%02X\r\n", ck)); m = write(pp->io.fd, buf, (unsigned)n); if (m < 0) |