]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
sourcestats: limit minimum value of std_dev
authorMiroslav Lichvar <mlichvar@redhat.com>
Fri, 23 Feb 2018 11:30:20 +0000 (12:30 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 26 Feb 2018 12:42:04 +0000 (13:42 +0100)
sourcestats.c

index 9c1c4dec7a02d19b7fd8bb73566958a0132b1fad..ff4c652e44dc04d5eeadb026b561b7ac6149a6e8 100644 (file)
@@ -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);