aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2013-12-04 13:19:04 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2013-12-04 13:19:04 +0100
commitcb1dc1d1d1c0132636454ecfdb6cac3eade323e6 (patch)
tree192f3cfcd707c63a875d6589e9e210dcc296081e
parent327f550669a80d72f36bc9e4de619c163aa46eff (diff)
downloadbusybox-w32-cb1dc1d1d1c0132636454ecfdb6cac3eade323e6.tar.gz
busybox-w32-cb1dc1d1d1c0132636454ecfdb6cac3eade323e6.tar.bz2
busybox-w32-cb1dc1d1d1c0132636454ecfdb6cac3eade323e6.zip
ntpd: let user know if spike was detected
function old new delta update_local_clock 861 943 +82 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/ntpd.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/networking/ntpd.c b/networking/ntpd.c
index 99817e83b..13cca3e77 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -1347,10 +1347,12 @@ update_local_clock(peer_t *p)
1347 * offset exceeds the step threshold and when it does not. 1347 * offset exceeds the step threshold and when it does not.
1348 */ 1348 */
1349 if (abs_offset > STEP_THRESHOLD) { 1349 if (abs_offset > STEP_THRESHOLD) {
1350 double remains;
1351
1350 switch (G.discipline_state) { 1352 switch (G.discipline_state) {
1351 case STATE_SYNC: 1353 case STATE_SYNC:
1352 /* The first outlyer: ignore it, switch to SPIK state */ 1354 /* The first outlyer: ignore it, switch to SPIK state */
1353 VERB3 bb_error_msg("offset:%+f - spike detected", offset); 1355 VERB2 bb_error_msg("offset:%+f - spike", offset);
1354 G.discipline_state = STATE_SPIK; 1356 G.discipline_state = STATE_SPIK;
1355 return -1; /* "decrease poll interval" */ 1357 return -1; /* "decrease poll interval" */
1356 1358
@@ -1358,9 +1360,10 @@ update_local_clock(peer_t *p)
1358 /* Ignore succeeding outlyers until either an inlyer 1360 /* Ignore succeeding outlyers until either an inlyer
1359 * is found or the stepout threshold is exceeded. 1361 * is found or the stepout threshold is exceeded.
1360 */ 1362 */
1361 if (since_last_update < WATCH_THRESHOLD) { 1363 remains = WATCH_THRESHOLD - since_last_update;
1362 VERB3 bb_error_msg("spike detected, datapoint ignored, %f sec remains", 1364 if (remains > 0) {
1363 WATCH_THRESHOLD - since_last_update); 1365 VERB2 bb_error_msg("spike, datapoint ignored, %f sec remains",
1366 remains);
1364 return -1; /* "decrease poll interval" */ 1367 return -1; /* "decrease poll interval" */
1365 } 1368 }
1366 /* fall through: we need to step */ 1369 /* fall through: we need to step */