Re: Please ignore patch [chrony-dev] [PATCH] MacOS X dynamic drift removal interval |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-dev Archives
]
- To: chrony-dev@xxxxxxxxxxxxxxxxxxxx
- Subject: Re: Please ignore patch [chrony-dev] [PATCH] MacOS X dynamic drift removal interval
- From: Bryan Christianson <bryan@xxxxxxxxxxxxx>
- Date: Tue, 18 Aug 2015 13:16:03 +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=Dp4eQI6+vmcucxEKTr7TD9HjIm6GjW9zV4PZx61W0DI=; b=CeUy8657aFzm Y+b/07/ovF0y8EY6y1MfK7XFQCblTe3Yxx72UMmTNCOBGjS2Yd3OKenHdVp5jEWQZUaxs+y6prFYG LGd0hkHaZaqsFfnroP/Jaaj2bMEroYKAnYnDA3CF9cCnajfaAbCmWCXJP0eO3pJ8crKcCmyXHUoIq DWB/SQCy/CUeAliyplJ6Xv3ULd/wS825tOTpvlK9vnJujuZdvq0KXkQvm5u0bbOy+lTSB2HHpEEZk MbVdBX6Rhz+LaTxrJIbAk5auDYTDWdp7wwhOUum8RiqR3Rl478aiS/tzeZjsiQB21DhG4Fbg6eMki dGp784ANnp8H0vVlgVBQdQ==;
- Feedback-id: 149811m:149811acx33YQ:149811syPp599vih:SMTPCORP
Stupid error - please ignore this patch. Should have learned by now to not make changes at 1:00 am.
> On 18/08/2015, at 7:59 am, Bryan Christianson <bryan@xxxxxxxxxxxxx> wrote:
>
> Adjust the drift removal interval based on the observed offset_sd.
> A newly calculated interval goes into effect after the current drift removal has completed.
> When offset_sd is high, the interval is increased resulting in fewer wakeups to adjust the drift offset.
> At lower values of offset_sd the drift removal adjustment interval is pinned to 0.5 seconds.
> The predicted error applied at the start of an adjustment is based on the remaining time of the drift removal that is currently in effect.
> Default drift removal adjustment interval is 4.0 seconds (was 1.0)
> If not synchronised set interval to maximum of default interval and current interval
> ---
> sys_macosx.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++-------
> 1 file changed, 61 insertions(+), 7 deletions(-)
>
> diff --git a/sys_macosx.c b/sys_macosx.c
> index 5d7c1d5..4b5279c 100644
> --- a/sys_macosx.c
> +++ b/sys_macosx.c
> @@ -70,6 +70,21 @@ static double current_freq;
>
> static double adjustment_requested;
>
> +/* Interval in seconds between adjustments to cancel systematic drift */
> +
> +#define DRIFT_REMOVAL_INTERVAL (4.0)
> +#define DRIFT_REMOVAL_INTERVAL_MIN (0.5)
> +
> +static double drift_removal_interval;
> +static double current_drift_removal_interval;
> +static struct timeval Tdrift;
> +
> +/* weighting applied to error in calculating drift_removal_interval */
> +#define ERROR_WEIGHT (0.5)
> +
> +/* minimum resolution of current_frequency */
> +#define FREQUENCY_RES (1.0e-9)
> +
> /* ================================================== */
>
> static void
> @@ -80,10 +95,13 @@ clock_initialise(void)
> offset_register = 0.0;
> adjustment_requested = 0.0;
> current_freq = 0.0;
> + drift_removal_interval = DRIFT_REMOVAL_INTERVAL;
> + current_drift_removal_interval = DRIFT_REMOVAL_INTERVAL;
>
> if (gettimeofday(&T0, NULL) < 0) {
> LOG_FATAL(LOGF_SysMacOSX, "gettimeofday() failed");
> }
> + Tdrift = T0;
>
> newadj.tv_sec = 0;
> newadj.tv_usec = 0;
> @@ -108,7 +126,7 @@ start_adjust(void)
> {
> struct timeval newadj, oldadj;
> struct timeval T1;
> - double elapsed, accrued_error, predicted_error;
> + double elapsed, accrued_error, predicted_error, drift_removal_elapsed;
> double adjust_required;
> double rounding_error;
> double old_adjust_remaining;
> @@ -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 = MIN(0.0, (current_drift_removal_interval - drift_removal_elapsed) / 2.0 * current_freq);
should be MAX not MIN
Sorry about that.
--
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.