From 14d25769243b676f3afcab644a26d6a78352afd4 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Wed, 21 Apr 2010 14:26:17 +0200 Subject: [PATCH] Remove absolute frequency from handler parameters None of the current handlers really need it and with temperature compensation enabled it would be necessary to undo the compensation before passing it to the handlers. --- local.c | 10 +++++----- local.h | 6 +----- manual.c | 2 -- ntp_sources.c | 2 -- refclock.c | 4 ++-- rtc_linux.c | 13 ++++--------- sched.c | 2 -- sources.c | 3 +-- 8 files changed, 13 insertions(+), 29 deletions(-) diff --git a/local.c b/local.c index dbda7444..b967bcd8 100644 --- a/local.c +++ b/local.c @@ -403,7 +403,7 @@ LCL_SetAbsoluteFrequency(double afreq_ppm) /* Dispatch to all handlers */ for (ptr = change_list.next; ptr != &change_list; ptr = ptr->next) { - (ptr->handler)(&raw, &cooked, dfreq, afreq_ppm, 0.0, 0, ptr->anything); + (ptr->handler)(&raw, &cooked, dfreq, 0.0, 0, ptr->anything); } current_freq_ppm = afreq_ppm; @@ -432,7 +432,7 @@ LCL_AccumulateDeltaFrequency(double dfreq) /* Dispatch to all handlers */ for (ptr = change_list.next; ptr != &change_list; ptr = ptr->next) { - (ptr->handler)(&raw, &cooked, dfreq, current_freq_ppm, 0.0, 0, ptr->anything); + (ptr->handler)(&raw, &cooked, dfreq, 0.0, 0, ptr->anything); } } @@ -455,7 +455,7 @@ LCL_AccumulateOffset(double offset) /* Dispatch to all handlers */ for (ptr = change_list.next; ptr != &change_list; ptr = ptr->next) { - (ptr->handler)(&raw, &cooked, 0.0, current_freq_ppm, offset, 0, ptr->anything); + (ptr->handler)(&raw, &cooked, 0.0, offset, 0, ptr->anything); } } @@ -478,7 +478,7 @@ LCL_ApplyStepOffset(double offset) /* Dispatch to all handlers */ for (ptr = change_list.next; ptr != &change_list; ptr = ptr->next) { - (ptr->handler)(&raw, &cooked, 0.0, current_freq_ppm, offset, 1, ptr->anything); + (ptr->handler)(&raw, &cooked, 0.0, offset, 1, ptr->anything); } } @@ -515,7 +515,7 @@ LCL_AccumulateFrequencyAndOffset(double dfreq, double doffset) /* Dispatch to all handlers */ for (ptr = change_list.next; ptr != &change_list; ptr = ptr->next) { - (ptr->handler)(&raw, &cooked, dfreq, current_freq_ppm, doffset, 0, ptr->anything); + (ptr->handler)(&raw, &cooked, dfreq, doffset, 0, ptr->anything); } diff --git a/local.h b/local.h index 2b9ea82d..373d246d 100644 --- a/local.h +++ b/local.h @@ -68,10 +68,6 @@ extern void LCL_GetOffsetCorrection(struct timeval *raw, double *correction, dou dfreq : delta frequency relative to previous value (in terms of seconds gained by system clock per unit system clock time) - afreq : absolute frequency relative to uncompensated system (in - terms of ppm seconds gained by system clock per unit of the - uncalibrated system clock) - doffset : delta offset applied (positive => make local system fast by that amount, negative => make it slow by that amount) @@ -83,7 +79,7 @@ extern void LCL_GetOffsetCorrection(struct timeval *raw, double *correction, dou typedef void (*LCL_ParameterChangeHandler) (struct timeval *raw, struct timeval *cooked, - double dfreq, double afreq_ppm, + double dfreq, double doffset, int is_step_change, void *anything ); diff --git a/manual.c b/manual.c index f3e98e1f..a1576324 100644 --- a/manual.c +++ b/manual.c @@ -74,7 +74,6 @@ static void slew_samples(struct timeval *raw, struct timeval *cooked, double dfreq, - double afreq, double doffset, int is_step_change, void *not_used); @@ -229,7 +228,6 @@ static void slew_samples(struct timeval *raw, struct timeval *cooked, double dfreq, - double afreq, double doffset, int is_step_change, void *not_used) diff --git a/ntp_sources.c b/ntp_sources.c index eeca7ced..97453aba 100644 --- a/ntp_sources.c +++ b/ntp_sources.c @@ -66,7 +66,6 @@ static void slew_sources(struct timeval *raw, struct timeval *cooked, double dfreq, - double afreq, double doffset, int is_step_change, void *anything); @@ -308,7 +307,6 @@ static void slew_sources(struct timeval *raw, struct timeval *cooked, double dfreq, - double afreq, double doffset, int is_step_change, void *anything) diff --git a/refclock.c b/refclock.c index f8f9d62d..f4f6c0cd 100644 --- a/refclock.c +++ b/refclock.c @@ -92,7 +92,7 @@ static LOG_FileID logfileid; static int valid_sample_time(RCL_Instance instance, struct timeval *tv); static int pps_stratum(RCL_Instance instance, struct timeval *tv); static void poll_timeout(void *arg); -static void slew_samples(struct timeval *raw, struct timeval *cooked, double dfreq, double afreq, +static void slew_samples(struct timeval *raw, struct timeval *cooked, double dfreq, double doffset, int is_step_change, void *anything); static void add_dispersion(double dispersion, void *anything); static void log_sample(RCL_Instance instance, struct timeval *sample_time, int filtered, int pulse, double raw_offset, double cooked_offset, double dispersion); @@ -540,7 +540,7 @@ poll_timeout(void *arg) } static void -slew_samples(struct timeval *raw, struct timeval *cooked, double dfreq, double afreq, +slew_samples(struct timeval *raw, struct timeval *cooked, double dfreq, double doffset, int is_step_change, void *anything) { int i; diff --git a/rtc_linux.c b/rtc_linux.c index 58141118..463d8b41 100644 --- a/rtc_linux.c +++ b/rtc_linux.c @@ -302,20 +302,15 @@ run_regression(int new_sample, static void slew_samples (struct timeval *raw, struct timeval *cooked, - double dfreq, double afreq_ppm, + double dfreq, double doffset, int is_step_change, void *anything) { int i; double elapsed; - double new_freq; - double old_freq; double delta_time; double old_seconds_fast, old_gain_rate; - new_freq = 1.0e-6 * afreq_ppm; - old_freq = (new_freq - dfreq) / (1.0 + dfreq); - for (i=0; i