summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko2013-12-04 13:19:04 +0100
committerDenys Vlasenko2013-12-04 13:19:04 +0100
commitcb1dc1d1d1c0132636454ecfdb6cac3eade323e6 (patch)
tree192f3cfcd707c63a875d6589e9e210dcc296081e
parent327f550669a80d72f36bc9e4de619c163aa46eff (diff)
downloadbusybox-cb1dc1d1d1c0132636454ecfdb6cac3eade323e6.zip
busybox-cb1dc1d1d1c0132636454ecfdb6cac3eade323e6.tar.gz
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 99817e8..13cca3e 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -1347,10 +1347,12 @@ update_local_clock(peer_t *p)
* offset exceeds the step threshold and when it does not.
*/
if (abs_offset > STEP_THRESHOLD) {
+ double remains;
+
switch (G.discipline_state) {
case STATE_SYNC:
/* The first outlyer: ignore it, switch to SPIK state */
- VERB3 bb_error_msg("offset:%+f - spike detected", offset);
+ VERB2 bb_error_msg("offset:%+f - spike", offset);
G.discipline_state = STATE_SPIK;
return -1; /* "decrease poll interval" */
@@ -1358,9 +1360,10 @@ update_local_clock(peer_t *p)
/* Ignore succeeding outlyers until either an inlyer
* is found or the stepout threshold is exceeded.
*/
- if (since_last_update < WATCH_THRESHOLD) {
- VERB3 bb_error_msg("spike detected, datapoint ignored, %f sec remains",
- WATCH_THRESHOLD - since_last_update);
+ remains = WATCH_THRESHOLD - since_last_update;
+ if (remains > 0) {
+ VERB2 bb_error_msg("spike, datapoint ignored, %f sec remains",
+ remains);
return -1; /* "decrease poll interval" */
}
/* fall through: we need to step */