From: Miroslav Lichvar Date: Mon, 12 Dec 2016 13:39:56 +0000 (+0100) Subject: sourcestats: save asymmetry run in dump files X-Git-Tag: 3.0-pre2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=95a4f3326515b98c2f7be1982254a5e6edd2fa07;p=thirdparty%2Fchrony.git sourcestats: save asymmetry run in dump files This allows the asymmetry correction to be applied right after restart. --- diff --git a/sourcestats.c b/sourcestats.c index eecd2328..166038d0 100644 --- a/sourcestats.c +++ b/sourcestats.c @@ -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;