For now, when converting a raw timestamp, return error of the last
sample as the maximum error of the timestamp. This is needed to include
the PHC reading delay in the NTP dispersion.
/* Number of samples */
int n_samples;
+ /* Maximum error of the last sample */
+ double last_err;
+
/* Flag indicating the offset and frequency values are valid */
int valid_coefs;
clock->n_samples++;
clock->hw_ref = *hw_ts;
clock->local_ref = *local_ts;
+ clock->last_err = err;
/* Get new coefficients */
clock->valid_coefs =
offset = clock->offset + elapsed / clock->frequency;
UTI_AddDoubleToTimespec(&clock->local_ref, offset, cooked);
- /* Estimation of the error is not implemented yet */
+ /* Fow now, just return the error of the last sample */
if (err)
- *err = 0.0;
+ *err = clock->last_err;
return 1;
}