+ delay = (T4 - T1) - (T3 - T2);
+ if (delay < G_precision_sec)
+ delay = G_precision_sec;
+ /*
+ * If this packet's delay is much bigger than the last one,
+ * it's better to just ignore it than use its much less precise value.
+ */
+ prev_delay = p->p_raw_delay;
+ p->p_raw_delay = delay;
+ if (p->reachable_bits && delay > prev_delay * BAD_DELAY_GROWTH) {
+ bb_error_msg("reply from %s: delay %f is too high, ignoring", p->p_dotted, delay);
+ goto pick_normal_interval;
+ }
+
+ p->lastpkt_delay = delay;
+ p->lastpkt_recv_time = T4;
+ VERB6 bb_error_msg("%s->lastpkt_recv_time=%f", p->p_dotted, p->lastpkt_recv_time);
+ p->lastpkt_status = msg.m_status;
+ p->lastpkt_stratum = msg.m_stratum;
+ p->lastpkt_rootdelay = sfp_to_d(msg.m_rootdelay);
+ p->lastpkt_rootdisp = sfp_to_d(msg.m_rootdisp);
+ p->lastpkt_refid = msg.m_refid;
+
+ p->datapoint_idx = p->reachable_bits ? (p->datapoint_idx + 1) % NUM_DATAPOINTS : 0;
+ datapoint = &p->filter_datapoint[p->datapoint_idx];
+ datapoint->d_recv_time = T4;
+ datapoint->d_offset = offset = ((T2 - T1) + (T3 - T4)) / 2;