mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-06 16:55:06 -05:00
hwclock: don't drop valid samples in HCL_ProcessReadings()
Modify the HCL_ProcessReadings() function to try to always provide a valid sample. Instead of dropping a sample outside of the expected delay, provide its assumed quality level as a small integer (relative to already accumulated samples), and let the caller decide what quality is acceptable.
This commit is contained in:
@@ -32,9 +32,9 @@ test_unit(void)
|
||||
{
|
||||
struct timespec start_hw_ts, start_local_ts, hw_ts, local_ts, ts;
|
||||
struct timespec readings[MAX_READINGS][3];
|
||||
int i, j, k, l, new_sample, n_readings, count, quality;
|
||||
HCL_Instance clock;
|
||||
double freq, jitter, interval, dj, err, sum;
|
||||
int i, j, k, l, new_sample, n_readings, count;
|
||||
|
||||
LCL_Initialise();
|
||||
TST_RegisterDummyDrivers();
|
||||
@@ -84,11 +84,13 @@ test_unit(void)
|
||||
|
||||
UTI_ZeroTimespec(&hw_ts);
|
||||
UTI_ZeroTimespec(&local_ts);
|
||||
if (HCL_ProcessReadings(clock, n_readings, readings, &hw_ts, &local_ts, &err)) {
|
||||
HCL_AccumulateSample(clock, &hw_ts, &local_ts, 2.0 * jitter);
|
||||
new_sample = 1;
|
||||
} else {
|
||||
new_sample = 0;
|
||||
new_sample = 0;
|
||||
if (HCL_ProcessReadings(clock, n_readings, readings, &hw_ts, &local_ts, &err, &quality)) {
|
||||
TEST_CHECK(quality >= 0 && quality <= 2);
|
||||
if (quality > 0) {
|
||||
HCL_AccumulateSample(clock, &hw_ts, &local_ts, 2.0 * jitter);
|
||||
new_sample = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user