Re: [chrony-dev] [PATCH] MacOS X - add drift removal |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-dev Archives
]
- To: chrony-dev@xxxxxxxxxxxxxxxxxxxx
- Subject: Re: [chrony-dev] [PATCH] MacOS X - add drift removal
- From: Bryan Christianson <bryan@xxxxxxxxxxxxx>
- Date: Wed, 12 Aug 2015 08:58:52 +1200
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpcorp.com; s=a0-2; h=Feedback-ID:X-Smtpcorp-Track:To:Message-Id:Date: From:Subject; bh=yXZWH8EQZ16RuaUeu/xJoJvxXZpKNUm8ZH9daUgbnkc=; b=zT9/F84kBL90 kSSbJPCqps1SjucZ/JcWtqPlvJ6lltqnScCdBtW4fkgJC6qYGHg2lOhGkiFnXJDRKDAM11DBqRzmq c9w5cbSRx98FBuqJ6C5FiNI0dmCQM4T9DPytkxPuUgQzxCHTpZ0zf8+L87udM3GAsdcE9/K0NX95i +wxtrJCD2Kw/7ik9f6kyufpC0CGilJy/tB9WySnfSeoFGo23UprKPf6XgATy0F+yfIF2XPVTNhc3o h6O10EDctslrjMBjflcLKeKiJWCpdbcPAdyhqCjJwQutDGhGV4uVnPMEITTUqpZukOtCPRVYheObQ vDbaierbGosrXpTp/th2Nw==;
- Feedback-id: 149811m:149811acx33YQ:149811ssmceaFbnH:SMTPCORP
Graph at http://whatroute.net/chrony/chrony-predict-error-20150812.png
Purple: frequency ppm
Green: offset_sd
Red: RMS offset
Magenta: mean (weighted) offset
Orange: mean (weighted) System time
Single lan connected stratum 1 NTP server
Predicted error patch
Dynamic drift_removal_interval (0.1 secs throughout test . i.e. minimum)
I think this result is pretty good - better then 1usec mean 'System time' most of the time.
> On 11/08/2015, at 10:59 pm, Miroslav Lichvar <mlichvar@xxxxxxxxxx> wrote:
>
> On Thu, Aug 06, 2015 at 04:57:43AM +1200, Bryan Christianson wrote:
>>> @@ -119,7 +119,7 @@ start_adjust(void)
>>> }
>>>
>>> UTI_DiffTimevalsToDouble(&elapsed, &T1, &T0);
>>> - accrued_error = elapsed * current_freq;
>>> + accrued_error = (elapsed + DRIFT_REMOVAL_INTERVAL / 2.0) * current_freq;
>>>
>>> adjust_required = - (accrued_error + offset_register);
>>
>> This changes the effective drift (as seen in tracking.log) from 18ppm to 6ppm but System time still hovers around -10us
>
> If it changes the reported drift, it doesn't work as intended :). The
> problem probably is that the the precorrection is not included in the
> offset register and when the adjustment is stopped, the register will
> be off by that value.
>
> How about this?
>
> --- a/sys_macosx.c
> +++ b/sys_macosx.c
> @@ -108,7 +108,7 @@ start_adjust(void)
> {
> struct timeval newadj, oldadj;
> struct timeval T1;
> - double elapsed, accrued_error;
> + double elapsed, accrued_error, expected_error;
> double adjust_required;
> double rounding_error;
> double old_adjust_remaining;
> @@ -120,8 +120,9 @@ start_adjust(void)
>
> UTI_DiffTimevalsToDouble(&elapsed, &T1, &T0);
> accrued_error = elapsed * current_freq;
> + expected_error = DRIFT_REMOVAL_INTERVAL / 2.0 * current_freq;
>
> - adjust_required = - (accrued_error + offset_register);
> + adjust_required = - (accrued_error + offset_register + expected_error);
>
> UTI_DoubleToTimeval(adjust_required, &newadj);
> UTI_TimevalToDouble(&newadj, &adjustment_requested);
> @@ -133,7 +134,7 @@ start_adjust(void)
>
> UTI_TimevalToDouble(&oldadj, &old_adjust_remaining);
>
> - offset_register = rounding_error - old_adjust_remaining;
> + offset_register = rounding_error - old_adjust_remaining - expected_error;
>
> T0 = T1;
> }
>
> --
> Miroslav Lichvar
>
> --
> 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.
>
--
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.