mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 23:45:07 -05:00
Update reported RMS offset quickly on start
This commit is contained in:
10
reference.c
10
reference.c
@@ -57,6 +57,7 @@ static double max_update_skew;
|
|||||||
|
|
||||||
static double last_offset;
|
static double last_offset;
|
||||||
static double avg2_offset;
|
static double avg2_offset;
|
||||||
|
static int avg2_moving;
|
||||||
|
|
||||||
static double correction_time_ratio;
|
static double correction_time_ratio;
|
||||||
|
|
||||||
@@ -709,10 +710,15 @@ REF_SetReference(int stratum,
|
|||||||
|
|
||||||
last_ref_update_interval = update_interval;
|
last_ref_update_interval = update_interval;
|
||||||
last_offset = our_offset;
|
last_offset = our_offset;
|
||||||
if (avg2_offset > 0.0)
|
|
||||||
|
/* Update the moving average of squares of offset, quickly on start */
|
||||||
|
if (avg2_moving) {
|
||||||
avg2_offset += 0.1 * (our_offset * our_offset - avg2_offset);
|
avg2_offset += 0.1 * (our_offset * our_offset - avg2_offset);
|
||||||
else
|
} else {
|
||||||
|
if (avg2_offset > 0.0 && avg2_offset < our_offset * our_offset)
|
||||||
|
avg2_moving = 1;
|
||||||
avg2_offset = our_offset * our_offset;
|
avg2_offset = our_offset * our_offset;
|
||||||
|
}
|
||||||
|
|
||||||
/* And now set the freq and offset to zero */
|
/* And now set the freq and offset to zero */
|
||||||
our_frequency = 0.0;
|
our_frequency = 0.0;
|
||||||
|
|||||||
Reference in New Issue
Block a user