summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/ntpd/refclock_mx4200.c
diff options
context:
space:
mode:
authorroberto <roberto@FreeBSD.org>2004-07-20 15:01:56 +0000
committerroberto <roberto@FreeBSD.org>2004-07-20 15:01:56 +0000
commit118e757284cbb8fc4f43a713e892b41504b50a5f (patch)
tree528d12dda44ebdc3ffcc38050f159ac553a69c17 /contrib/ntp/ntpd/refclock_mx4200.c
parenta85d9ae25e8e8696677bc30feb6eaf7fc150e529 (diff)
downloadFreeBSD-src-118e757284cbb8fc4f43a713e892b41504b50a5f.zip
FreeBSD-src-118e757284cbb8fc4f43a713e892b41504b50a5f.tar.gz
Virgin import of ntpd 4.2.0
Diffstat (limited to 'contrib/ntp/ntpd/refclock_mx4200.c')
-rw-r--r--contrib/ntp/ntpd/refclock_mx4200.c26
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)
OpenPOWER on IntegriCloud