[Git][NTPsec/ntpsec][master] Merge bumpclock into ntpfrob and document it.

Eric S. Raymond gitlab at mg.gitlab.com
Sat Jul 23 11:20:55 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
fec60596 by Eric S. Raymond at 2016-07-23T07:19:28-04:00
Merge bumpclock into ntpfrob and document it.

- - - - -


6 changed files:

- docs/includes/ntpfrob-body.txt
- util/bumpclock.c → ntpfrob/bumpclock.c
- ntpfrob/main.c
- ntpfrob/ntpfrob.h
- ntpfrob/wscript
- util/wscript


Changes:

=====================================
docs/includes/ntpfrob-body.txt
=====================================
--- a/docs/includes/ntpfrob-body.txt
+++ b/docs/includes/ntpfrob-body.txt
@@ -5,7 +5,7 @@
 [[synop]]
 == Synopsis ==
 
-+{ntpfrob}+ [ +-A+] [ +-a+ 'tick' ] [ +-p+ 'ppsdev' ] [+-c+] [+-e+] [+-r+]
++{ntpfrob}+ [ +-A+] [+-b+ 'bump'] [ +-a+ 'tick' ] [ +-p+ 'ppsdev' ] [+-c+] [+-e+] [+-r+]
 
 [[descr]]
 == Description ==
@@ -23,6 +23,8 @@ utilities.
   Set the kernel variable +tick+ to the value _tick_ specifies.
 +-A+::
   Display the kernel variable +tick+.
++-b+ 'bump'::
+  Bump the clock by a specified number of microceseconds.
 +-c+::
   Compute and display clock jitter.
 +-e+::
@@ -65,6 +67,12 @@ The -j option is applicable to this mode.
 Tweaking your tick rate is almost never necessary on hardware new
 enough to have a fully POSIX.1-2001-conformant Unix.
 
+=== Clock bump ===
+
+Sometimes it is diagnostically interesting to peturb your clock in
+order to watch how {ntpd} responds and makes corrections. This
+option does that.
+
 === Clock jitter measurement ===
 
 The -c option can be used to determine the timing jitter due to the


=====================================
util/bumpclock.c → ntpfrob/bumpclock.c
=====================================
--- a/util/bumpclock.c
+++ b/ntpfrob/bumpclock.c
@@ -10,15 +10,12 @@
 #include <string.h>
 #include <sys/time.h>
 
-int main(int argc, char *argv[]) {
+void bumpclock(int bump)
+{
     struct timeval was, set, now;
     int rc1, rc2, rc3;
     int er1, er2, er3;
-    int bump = 100000;
 
-    if (argc > 1) {
-	bump = atoi(argv[1]);
-    }
     printf("Bumping clock by %d microseconds.\n", bump);
 
     rc1 = gettimeofday(&was, NULL);
@@ -57,7 +54,4 @@ int main(int argc, char *argv[]) {
 	printf("Couldn't set time: %s\n", strerror(er3));
     else
 	printf("Now: %ld.%06ld\n", (long)now.tv_sec, (long)now.tv_usec);
-
-    return (rc1!=0 || rc2!=0 || rc3!=0);
-
 }


=====================================
ntpfrob/main.c
=====================================
--- a/ntpfrob/main.c
+++ b/ntpfrob/main.c
@@ -18,7 +18,7 @@ main(int argc, char **argv)
 	int ch;
 	iomode mode = plain_text;
 	init_lib();
-	while ((ch = getopt(argc, argv, "a:Acejp:r")) != EOF) {
+	while ((ch = getopt(argc, argv, "a:Ab:cejp:r")) != EOF) {
 		switch (ch) {
 		case 'A':
 #ifdef HAVE_ADJTIMEX
@@ -36,6 +36,9 @@ main(int argc, char **argv)
 		    exit(0);
 #endif
 		    break;
+		case 'b':
+		    bumpclock(atoi(optarg));
+		    break;
 		case 'c':
 		    jitter(mode);
 		    exit(0);


=====================================
ntpfrob/ntpfrob.h
=====================================
--- a/ntpfrob/ntpfrob.h
+++ b/ntpfrob/ntpfrob.h
@@ -5,6 +5,7 @@ typedef enum {plain_text, raw, json} iomode;
 
 extern void ppscheck(char *device);
 extern void tickadj(const iomode mode, const int tick);
+extern void bumpclock(int);
 extern void jitter(const iomode mode);
 extern void stepback(void);
 extern void precision(const iomode mode);


=====================================
ntpfrob/wscript
=====================================
--- a/ntpfrob/wscript
+++ b/ntpfrob/wscript
@@ -4,7 +4,7 @@ def build(ctx):
 	srcnode = ctx.srcnode.abspath()
 	bldnode = ctx.bldnode.abspath()
 
-	frob_sources = ['main.c', 'jitter.c', 'precision.c',
+	frob_sources = ['main.c', 'bumpclock.c', 'jitter.c', 'precision.c',
 			'pps-api.c', 'tickadj.c']
 
 	ctx(


=====================================
util/wscript
=====================================
--- a/util/wscript
+++ b/util/wscript
@@ -4,7 +4,7 @@ def build(ctx):
 	srcnode = ctx.srcnode.abspath()
 	bldnode = ctx.bldnode.abspath()
 
-	util = ['bumpclock', 'hist', 'propdelay', 'sht']
+	util = ['hist', 'propdelay', 'sht']
 
 	if ctx.env.HAVE_AUDIO:
 		util += ['tg2']



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/fec605966380d7e19df48a50cea1f939b781e23f
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160723/1e50d246/attachment.html>


More information about the vc mailing list