diff --git a/sourcestats.c b/sourcestats.c index 745026d..0c19624 100644 --- a/sourcestats.c +++ b/sourcestats.c @@ -174,9 +174,8 @@ struct SST_Stats_Record { time of the measurements */ double root_dispersions[MAX_SAMPLES]; - /* This array contains the strata that were associated with the sources - at the times the samples were generated */ - int strata[MAX_SAMPLES]; + /* The stratum from the last accumulated sample */ + int stratum; /* The leap status from the last accumulated sample */ NTP_Leap leap; @@ -323,7 +322,7 @@ SST_AccumulateSample(SST_Stats inst, struct timespec *sample_time, inst->peer_dispersions[m] = peer_dispersion; inst->root_delays[m] = root_delay; inst->root_dispersions[m] = root_dispersion; - inst->strata[m] = stratum; + inst->stratum = stratum; inst->leap = leap; if (inst->peer_delays[n] < inst->fixed_min_delay) @@ -660,7 +659,7 @@ SST_GetSelectionData(SST_Stats inst, struct timespec *now, i = get_runsbuf_index(inst, inst->best_single_sample); j = get_buf_index(inst, inst->best_single_sample); - *stratum = inst->strata[get_buf_index(inst, inst->n_samples - 1)]; + *stratum = inst->stratum; *leap = inst->leap; *std_dev = inst->std_dev; @@ -869,7 +868,7 @@ SST_SaveToFile(SST_Stats inst, FILE *out) inst->root_delays[j], inst->root_dispersions[j], 1.0, /* used to be inst->weights[i] */ - inst->strata[j]); + inst->stratum /* used to be an array */); } @@ -914,7 +913,7 @@ SST_LoadFromFile(SST_Stats inst, FILE *in) &(inst->root_delays[i]), &(inst->root_dispersions[i]), &weight, /* not used anymore */ - &(inst->strata[i])) != 10)) { + &inst->stratum) != 10)) { /* This is the branch taken if the read FAILED */ @@ -962,7 +961,7 @@ SST_DoSourceReport(SST_Stats inst, RPT_SourceReport *report, struct timespec *no report->orig_latest_meas = inst->orig_offsets[j]; report->latest_meas = inst->offsets[i]; report->latest_meas_err = 0.5*inst->root_delays[j] + inst->root_dispersions[j]; - report->stratum = inst->strata[j]; + report->stratum = inst->stratum; /* Align the sample time to reduce the leak of the receive timestamp */ last_sample_time = inst->sample_times[i];