[ntpsec commit] Forward-port util/pps-api.c and build it.

Eric S. Raymond esr at ntpsec.org
Wed Sep 30 16:00:51 UTC 2015


Module:    ntpsec
Branch:    master
Commit:    d9c87cb451e0e5b51e73cece04addd3912ea467c
Changeset: http://git.ntpsec.org/ntpsec/commit/?id=d9c87cb451e0e5b51e73cece04addd3912ea467c

Author:    Eric S. Raymond <esr at thyrsus.com>
Date:      Wed Sep 30 12:00:13 2015 -0400

Forward-port util/pps-api.c and build it.

---

 util/pps-api.c | 14 +++++++++-----
 util/wscript   |  2 +-
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/util/pps-api.c b/util/pps-api.c
index f8bc4bb..ac03992 100644
--- a/util/pps-api.c
+++ b/util/pps-api.c
@@ -7,10 +7,10 @@ Poul-Henning
 
 */
 
+#include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <err.h>
 #include <sys/types.h>
 #include <time.h>
 #include <sys/timepps.h>
@@ -29,11 +29,10 @@ Poul-Henning
 void
 Chew(struct timespec *tsa, struct timespec *tsc, unsigned sa, unsigned sc)
 {
-	static int idx;
 	struct timespec ts;
 
-	printf("%d.%09d ", tsa->tv_sec, tsa->tv_nsec);
-	printf("%d.%09d ", tsc->tv_sec, tsc->tv_nsec);
+	printf("%ld.%09ld ", tsa->tv_sec, tsa->tv_nsec);
+	printf("%ld.%09ld ", tsc->tv_sec, tsc->tv_nsec);
 	printf("%u %u ", sa, sc);
 
 	ts = *tsc;
@@ -43,6 +42,12 @@ Chew(struct timespec *tsa, struct timespec *tsc, unsigned sa, unsigned sc)
 	fflush(stdout);
 }
 
+static int err(int out, const char *legend)
+{
+    fprintf(stderr, "pps-api: %s\n", legend);
+    exit(out);
+}
+
 int
 main(int argc, char **argv)
 {
@@ -52,7 +57,6 @@ main(int argc, char **argv)
 	pps_handle_t ph;
 	int i, mode;
 	u_int olda, oldc;
-	double d = 0;
 	struct timespec to;
 
 	if (argc < 2)
diff --git a/util/wscript b/util/wscript
index c20d908..a22482a 100644
--- a/util/wscript
+++ b/util/wscript
@@ -26,7 +26,7 @@ def build(ctx):
 		install_path= "${PREFIX}/sbin/"
 	)
 
-	for name in ['hist', 'jitter', 'precision', 'sht', 'testrs6000']:
+	for name in ['hist', 'jitter', 'pps-api', 'precision', 'sht', 'testrs6000']:
 		ctx(
 			target		= name,
 			features	= "c cprogram bld_include src_include libisc_include",



More information about the vc mailing list