Re: [chrony-dev] [PATCH] MacOS X dynamic drift removal interval

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


> On 18/08/2015, at 7:56 pm, Miroslav Lichvar <mlichvar@xxxxxxxxxx> wrote:
> 
> On Tue, Aug 18, 2015 at 01:22:15PM +1200, Bryan Christianson wrote:
>> @@ -120,7 +138,14 @@ start_adjust(void)
>> 
>>  UTI_DiffTimevalsToDouble(&elapsed, &T1, &T0);
>>  accrued_error = elapsed * current_freq;
>> -  predicted_error = DRIFT_REMOVAL_INTERVAL / 2.0 * current_freq;
>> +
>> +  UTI_DiffTimevalsToDouble(&drift_removal_elapsed, &T1, &Tdrift);
>> +  predicted_error = MAX(0.0, (current_drift_removal_interval -  drift_removal_elapsed) / 2.0 * current_freq);
> 
> If current_freq was negative, wouldn't predicted_error end up as zero?
> I think drift_removal_elapsed needs to be clamped before
> predicted_error is calculated. It shouldn't be negative and it
> shouldn't be larger than current_drift_removal_interval, to not get an
> insane error with both backward and forward clock jumps.


Oops - of course. You're right. I'll fix it now.

-- 
Bryan Christianson


--
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/