[git commit] ntpd: comment out "spike detection" code

Denys Vlasenko vda.linux at googlemail.com
Wed Dec 4 16:12:11 UTC 2013


commit: http://git.busybox.net/busybox/commit/?id=6c46eed6e935db43dedbff1d026e4cf68f0bc67e
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
update_local_clock                                   982     835    -147

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 networking/ntpd.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/networking/ntpd.c b/networking/ntpd.c
index aeef043..f3a4177 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -334,7 +334,7 @@ struct globals {
 
 #define STATE_NSET      0       /* initial state, "nothing is set" */
 //#define STATE_FSET    1       /* frequency set from file */
-#define STATE_SPIK      2       /* spike detected */
+//#define STATE_SPIK    2       /* spike detected */
 //#define STATE_FREQ    3       /* initial frequency */
 #define STATE_SYNC      4       /* clock synchronized (normal operation) */
 	uint8_t  discipline_state;      // doc calls it c.state
@@ -1350,11 +1350,15 @@ update_local_clock(peer_t *p)
 	 * offset exceeds the step threshold and when it does not.
 	 */
 	if (abs_offset > STEP_THRESHOLD) {
+#if 0
 		double remains;
 
-// TODO: this "spike state" seems to be useless, peer selection already drops
-// occassional "bad" datapoints. If we are here, there were _many_ large offsets -
-// looks like _our_ clock is off.
+// This "spike state" seems to be useless, peer selection already drops
+// occassional "bad" datapoints. If we are here, there were _many_
+// large offsets. When a few first large offsets are seen,
+// we end up in "no valid datapoints, no peer selected" state.
+// Only when enough of them are seen (which means it's not a fluke),
+// we end up here. Looks like _our_ clock is off.
 		switch (G.discipline_state) {
 		case STATE_SYNC:
 			/* The first outlyer: ignore it, switch to SPIK state */
@@ -1377,6 +1381,7 @@ update_local_clock(peer_t *p)
 			}
 			/* fall through: we need to step */
 		} /* switch */
+#endif
 
 		/* Step the time and clamp down the poll interval.
 		 *


More information about the busybox-cvs mailing list