summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Schlyter <jakob@cvs.openbsd.org>2002-05-16 15:01:33 +0000
committerJakob Schlyter <jakob@cvs.openbsd.org>2002-05-16 15:01:33 +0000
commit3c84065baa36dcda7c169ed626cb43b28078c34a (patch)
tree518d85add08e28af1d9ef7a5c6ded1386c70c0a2
parente207a0da808ebbabc696b82bf62ccb6163250701 (diff)
#ifdef DEBUG some verbose output, may be moved to a -v flag later perhaps
-rw-r--r--usr.sbin/rdate/ntp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/rdate/ntp.c b/usr.sbin/rdate/ntp.c
index 1391cc29e64..041afa6d66b 100644
--- a/usr.sbin/rdate/ntp.c
+++ b/usr.sbin/rdate/ntp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntp.c,v 1.3 2002/05/16 11:00:53 deraadt Exp $ */
+/* $OpenBSD: ntp.c,v 1.4 2002/05/16 15:01:32 jakob Exp $ */
/*
* Copyright (c) 1996, 1997 by N.M. Maclaren. All rights reserved.
@@ -158,7 +158,9 @@ ntp_client(const char *hostname, struct timeval *new, struct timeval *adjust)
if (error > NTP_INSANITY)
errx(1, "Unable to get a reasonable time estimate");
+#ifdef DEBUG
fprintf(stderr,"Correction: %.6f +/- %.6f\n", offset,error);
+#endif
create_timeval(offset, new, adjust);
}
@@ -193,8 +195,10 @@ sync_ntp(int fd, const struct sockaddr *peer, double *offset, double *error)
} else
++accepts;
+#ifdef DEBUG
fprintf(stderr,"Offset: %.6f +/- %.6f disp=%.6f\n",
x, y, dispersion);
+#endif
if ((a = x - *offset) < 0.0)
a = -a;
@@ -206,7 +210,9 @@ sync_ntp(int fd, const struct sockaddr *peer, double *offset, double *error)
*error = y;
}
+#ifdef DEBUG
fprintf(stderr,"Best: %.6f +/- %.6f\n", *offset, *error);
+#endif
if (a > b)
errx(1, "Inconsistent times recieved from NTP server");