]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
Add minimum skew limit to sourcestats
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 19 Jun 2013 08:22:49 +0000 (10:22 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 19 Jun 2013 08:22:49 +0000 (10:22 +0200)
sourcestats.c

index 616b32629d540722c5ef32b335db4bc05b4a4977..8df77400caa10348899c932fe86bf3d1406a5472 100644 (file)
@@ -51,6 +51,9 @@ int min_samples;
    2000ppm, which would be pretty bad */
 #define WORST_CASE_FREQ_BOUND (2000.0/1.0e6)
 
+/* The minimum allowed skew */
+#define MIN_SKEW 1.0e-12
+
 /* ================================================== */
 
 static LOG_FileID logfileid;
@@ -453,6 +456,9 @@ SST_DoNewRegression(SST_Stats inst)
     inst->variance = est_var;
     inst->nruns = nruns;
 
+    if (inst->skew < MIN_SKEW)
+      inst->skew = MIN_SKEW;
+
     stress = fabs(old_freq - inst->estimated_frequency) / old_skew;
 
     if (best_start > 0) {