{
int i, j, index;
struct timeval now;
- int src_select_ok;
double src_offset, src_offset_sd, src_frequency, src_skew;
double src_accrued_dispersion;
int n_endpoints, j1, j2;
int min_distance_index;
struct SelectInfo *si;
double total_root_dispersion;
- int n_reachable_sources;
NTP_Leap leap_status = LEAP_Normal;
/* Step 1 - build intervals about each source */
n_endpoints = 0;
- n_reachable_sources = 0;
+ n_sel_sources = 0;
for (i=0; i<n_sources; i++) {
if (sources[i]->reachable && sources[i]->sel_option != SRC_SelectNoselect) {
- ++n_reachable_sources;
-
si = &(sources[i]->sel_info);
SST_GetSelectionData(sources[i]->stats, &now,
&(si->stratum),
&(si->variance),
&(si->select_ok));
- /* Eventually this might be a flag indicating whether the get
- selection data call was successful. For now it always is. */
- src_select_ok = 1;
-
si->root_distance = si->root_dispersion + 0.5 * fabs(si->root_delay);
si->lo_limit = si->best_offset - si->root_distance;
si->hi_limit = si->best_offset + si->root_distance;
si->lo_limit, si->hi_limit);
#endif
- if (src_select_ok) {
+ if (si->select_ok) {
+ ++n_sel_sources;
sources[i]->status = SRC_OK; /* For now */
best_depth, best_lo, best_hi);
#endif
- if (best_depth <= n_reachable_sources/2) {
+ if (best_depth <= n_sel_sources/2) {
/* Could not even get half the reachable sources to agree -
clearly we can't synchronise.
/* The index of the newest sample */
int last_sample;
+ /* Flag indicating whether last regression was successful */
+ int regression_ok;
+
/* The best individual sample that we are holding, in terms of the minimum
root distance at the present time */
int best_single_sample;
inst->n_samples = 0;
inst->runs_samples = 0;
inst->last_sample = 0;
+ inst->regression_ok = 0;
inst->best_single_sample = 0;
inst->min_delay_sample = 0;
inst->estimated_frequency = 0;
double sd_weight, sd;
double old_skew, old_freq, stress;
- int regression_ok;
-
convert_to_intervals(inst, times_back + inst->runs_samples);
if (inst->n_samples > 0) {
}
}
- regression_ok = RGR_FindBestRegression(times_back + inst->runs_samples,
+ inst->regression_ok = RGR_FindBestRegression(times_back + inst->runs_samples,
offsets + inst->runs_samples, weights,
inst->n_samples, inst->runs_samples,
&est_intercept, &est_slope, &est_var,
&est_intercept_sd, &est_slope_sd,
&best_start, &nruns, °rees_of_freedom);
- if (regression_ok) {
+ if (inst->regression_ok) {
old_skew = inst->skew;
old_freq = inst->estimated_frequency;
int *stratum,
double *best_offset, double *best_root_delay,
double *best_root_dispersion,
- double *variance, int *average_ok)
+ double *variance, int *select_ok)
{
double average_offset;
double sample_elapsed;
double elapsed;
int i, j;
+ int average_ok;
double peer_distance;
i = get_runsbuf_index(inst, inst->best_single_sample);
*best_root_delay = inst->root_delays[j];
*best_root_dispersion = inst->root_dispersions[j] + sample_elapsed * inst->skew;
+ /* average_ok ignored for now */
average_offset = inst->estimated_offset + inst->estimated_frequency * elapsed;
if (fabs(average_offset - *best_offset) <= peer_distance) {
- *average_ok = 1;
+ average_ok = 1;
} else {
- *average_ok = 0;
+ average_ok = 0;
}
+ *select_ok = inst->regression_ok;
+
#ifdef TRACEON
- LOG(LOGS_INFO, LOGF_SourceStats, "n=%d off=%f del=%f dis=%f var=%f pdist=%f avoff=%f avok=%d",
+ LOG(LOGS_INFO, LOGF_SourceStats, "n=%d off=%f del=%f dis=%f var=%f pdist=%f avoff=%f avok=%d selok=%d",
inst->n_samples, *best_offset, *best_root_delay, *best_root_dispersion, *variance,
- peer_distance, average_offset, *average_ok);
+ peer_distance, average_offset, average_ok, *select_ok);
#endif
return;