From: Miroslav Lichvar Date: Fri, 23 Feb 2018 11:30:20 +0000 (+0100) Subject: sourcestats: limit minimum value of std_dev X-Git-Tag: 3.3-pre1~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e79a6c21164c84d35b699349839a88a7ee13745b;p=thirdparty%2Fchrony.git sourcestats: limit minimum value of std_dev --- diff --git a/sourcestats.c b/sourcestats.c index 9c1c4dec..ff4c652e 100644 --- a/sourcestats.c +++ b/sourcestats.c @@ -51,6 +51,9 @@ #define MIN_SKEW 1.0e-12 #define MAX_SKEW 1.0e+02 +/* The minimum standard deviation */ +#define MIN_STDDEV 1.0e-9 + /* The asymmetry of network jitter when all jitter is in one direction */ #define MAX_ASYMMETRY 0.5 @@ -571,7 +574,7 @@ SST_DoNewRegression(SST_Stats inst) inst->estimated_offset = est_intercept; inst->offset_time = inst->sample_times[inst->last_sample]; inst->estimated_offset_sd = est_intercept_sd; - inst->std_dev = sqrt(est_var); + inst->std_dev = MAX(MIN_STDDEV, sqrt(est_var)); inst->nruns = nruns; inst->skew = CLAMP(MIN_SKEW, inst->skew, MAX_SKEW);