]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
sourcestats: save asymmetry run in dump files
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 12 Dec 2016 13:39:56 +0000 (14:39 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 13 Dec 2016 11:57:25 +0000 (12:57 +0100)
This allows the asymmetry correction to be applied right after restart.

sourcestats.c

index eecd2328d9ce88562846ba99217d40b4e958a36f..166038d0423eeee3622be3b7efd267324f184caf 100644 (file)
@@ -844,6 +844,8 @@ SST_SaveToFile(SST_Stats inst, FILE *out)
             inst->strata[j]);
 
   }
+
+  fprintf(out, "%d\n", inst->asymmetry_run);
 }
 
 /* ================================================== */
@@ -898,6 +900,10 @@ SST_LoadFromFile(SST_Stats inst, FILE *in)
         UTI_NormaliseTimespec(&inst->sample_times[i]);
       }
     }
+
+    /* This field was not saved in older versions */
+    if (!fgets(line, sizeof(line), in) || sscanf(line, "%d\n", &inst->asymmetry_run) != 1)
+      inst->asymmetry_run = 0;
   } else {
     inst->n_samples = 0; /* Load abandoned if any sign of corruption */
     return 0;