]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
Remove absolute frequency from handler parameters
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 21 Apr 2010 12:26:17 +0000 (14:26 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 27 Apr 2010 12:35:27 +0000 (14:35 +0200)
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
local.h
manual.c
ntp_sources.c
refclock.c
rtc_linux.c
sched.c
sources.c

diff --git a/local.c b/local.c
index dbda7444982382b337fc58103ec0b8b7c0587275..b967bcd861d743eefd27e15c6a950ea1ae8d0c2d 100644 (file)
--- 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 2b9ea82d5f264c608392b7dbbbd1072b3f0c4a65..373d246d422eb53746f17c35f264a1258ab70059 100644 (file)
--- 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
       );
index f3e98e1f50868e14b8ca8542aa6cb1c768d9fba7..a1576324240b6e2958533ed31ea5ea589c37994b 100644 (file)
--- 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)
index eeca7ced1140ff1121cab0dd3461b95cf4365581..97453abaaefe517112f892d9b61951678ad6e954 100644 (file)
@@ -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)
index f8f9d62d56ab7069cf450776d1d8d35ddd81edf9..f4f6c0cdc23703aca43eb04d7e7304c507560818 100644 (file)
@@ -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;
index 581411186132bd401fb8d6b0db6b40961bc687e9..463d8b41a18035c45b6b73ce196a8a1b117b7d58 100644 (file)
@@ -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<n_samples; i++) {
     UTI_DiffTimevalsToDouble(&elapsed, cooked, system_times + i);
 
@@ -330,12 +325,12 @@ slew_samples
 
   if (coefs_valid) {
     coef_seconds_fast += doffset;
-    coef_gain_rate = 1.0 - ((1.0 + new_freq) / (1.0 + old_freq)) * (1.0 - coef_gain_rate);
+    coef_gain_rate = 1.0 - (1.0 + dfreq) * (1.0 - coef_gain_rate);
   }
 
 #if 0
-  LOG(LOGS_INFO, LOGF_RtcLinux, "dfreq=%.8f doffset=%.6f new_freq=%.3f old_freq=%.3f old_fast=%.6f old_rate=%.3f new_fast=%.6f new_rate=%.3f",
-      dfreq, doffset, 1.0e6*new_freq, 1.0e6*old_freq,
+  LOG(LOGS_INFO, LOGF_RtcLinux, "dfreq=%.8f doffset=%.6f old_fast=%.6f old_rate=%.3f new_fast=%.6f new_rate=%.3f",
+      dfreq, doffset,
       old_seconds_fast, 1.0e6 * old_gain_rate,
       coef_seconds_fast, 1.0e6 * coef_gain_rate);
 #endif
diff --git a/sched.c b/sched.c
index c2d44b912b49389fa0029bc23e85cd11fe48192a..908f50bbcfe891746a1e9aec600172d241dfe081 100644 (file)
--- a/sched.c
+++ b/sched.c
@@ -120,7 +120,6 @@ static void
 handle_slew(struct timeval *raw,
             struct timeval *cooked,
             double dfreq,
-            double afreq,
             double doffset,
             int is_step_change,
             void *anything);
@@ -498,7 +497,6 @@ static void
 handle_slew(struct timeval *raw,
             struct timeval *cooked,
             double dfreq,
-            double afreq,
             double doffset,
             int is_step_change,
             void *anything)
index f1674f22aaa7eb9c772867520b644b2904f0399b..f86f198fd2e58c282bd031cc9cd602e5b63e2083 100644 (file)
--- a/sources.c
+++ b/sources.c
@@ -128,7 +128,7 @@ static int selected_source_index; /* Which source index is currently
 /* Forward prototype */
 
 static void
-slew_sources(struct timeval *raw, struct timeval *cooked, double dfreq, double afreq,
+slew_sources(struct timeval *raw, struct timeval *cooked, double dfreq,
              double doffset, int is_step_change, void *anything);
 static void
 add_dispersion(double dispersion, void *anything);
@@ -798,7 +798,6 @@ static void
 slew_sources(struct timeval *raw,
              struct timeval *cooked,
              double dfreq,
-             double afreq,
              double doffset,
              int is_step_change,
              void *anything)