Prepare for a new change type that will be added later.
static void
invoke_parameter_change_handlers(struct timeval *raw, struct timeval *cooked,
double dfreq, double doffset,
- int is_step_change)
+ LCL_ChangeType change_type)
{
ChangeListEntry *ptr;
for (ptr = change_list.next; ptr != &change_list; ptr = ptr->next) {
- (ptr->handler)(raw, cooked, dfreq, doffset, is_step_change, ptr->anything);
+ (ptr->handler)(raw, cooked, dfreq, doffset, change_type, ptr->anything);
}
}
LCL_CookTime(&raw, &cooked, NULL);
/* Dispatch to all handlers */
- invoke_parameter_change_handlers(&raw, &cooked, dfreq, 0.0, 0);
+ invoke_parameter_change_handlers(&raw, &cooked, dfreq, 0.0, LCL_ChangeAdjust);
current_freq_ppm = afreq_ppm;
LCL_CookTime(&raw, &cooked, NULL);
/* Dispatch to all handlers */
- invoke_parameter_change_handlers(&raw, &cooked, dfreq, 0.0, 0);
+ invoke_parameter_change_handlers(&raw, &cooked, dfreq, 0.0, LCL_ChangeAdjust);
}
/* ================================================== */
(*drv_accrue_offset)(offset, corr_rate);
/* Dispatch to all handlers */
- invoke_parameter_change_handlers(&raw, &cooked, 0.0, offset, 0);
+ invoke_parameter_change_handlers(&raw, &cooked, 0.0, offset, LCL_ChangeAdjust);
}
/* ================================================== */
(*drv_apply_step_offset)(offset);
/* Dispatch to all handlers */
- invoke_parameter_change_handlers(&raw, &cooked, 0.0, offset, 1);
+ invoke_parameter_change_handlers(&raw, &cooked, 0.0, offset, LCL_ChangeStep);
}
/* ================================================== */
double offset, double dispersion)
{
/* Dispatch to all handlers */
- invoke_parameter_change_handlers(raw, cooked, 0.0, offset, 1);
+ invoke_parameter_change_handlers(raw, cooked, 0.0, offset, LCL_ChangeStep);
lcl_InvokeDispersionNotifyHandlers(dispersion);
}
doffset : delta offset applied (positive => make local system fast
by that amount, negative => make it slow by that amount)
- is_step_change : true if change is being applied as a jump (using
- settimeofday rather than adjtime)
+ change_type : what type of change is being applied
anything : Passthrough argument from call to registration routine */
+typedef enum {
+ LCL_ChangeAdjust,
+ LCL_ChangeStep
+} LCL_ChangeType;
+
typedef void (*LCL_ParameterChangeHandler)
(struct timeval *raw, struct timeval *cooked,
double dfreq,
- double doffset, int is_step_change,
+ double doffset,
+ LCL_ChangeType change_type,
void *anything
);
struct timeval *cooked,
double dfreq,
double doffset,
- int is_step_change,
+ LCL_ChangeType change_type,
void *not_used);
/* ================================================== */
struct timeval *cooked,
double dfreq,
double doffset,
- int is_step_change,
+ LCL_ChangeType change_type,
void *not_used)
{
double delta_time;
struct timeval *cooked,
double dfreq,
double doffset,
- int is_step_change,
+ LCL_ChangeType change_type,
void *anything);
/* ================================================== */
struct timeval *cooked,
double dfreq,
double doffset,
- int is_step_change,
+ LCL_ChangeType change_type,
void *anything)
{
int i;
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 doffset, int is_step_change, void *anything);
+ double doffset, LCL_ChangeType change_type, 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);
static void
slew_samples(struct timeval *raw, struct timeval *cooked, double dfreq,
- double doffset, int is_step_change, void *anything)
+ double doffset, LCL_ChangeType change_type, void *anything)
{
int i;
struct timeval *cooked,
double dfreq,
double doffset,
- int is_step_change,
+ LCL_ChangeType change_type,
void *anything)
{
- if (is_step_change) {
+ if (change_type == LCL_ChangeStep) {
UTI_AddDoubleToTimeval(&last_ref_update, -doffset, &last_ref_update);
}
}
slew_samples
(struct timeval *raw, struct timeval *cooked,
double dfreq,
- double doffset, int is_step_change,
+ double doffset,
+ LCL_ChangeType change_type,
void *anything)
{
int i;
struct timeval *cooked,
double dfreq,
double doffset,
- int is_step_change,
+ LCL_ChangeType change_type,
void *anything);
/* ================================================== */
struct timeval *cooked,
double dfreq,
double doffset,
- int is_step_change,
+ LCL_ChangeType change_type,
void *anything)
{
TimerQueueEntry *ptr;
double delta;
int i;
- if (is_step_change) {
+ if (change_type != LCL_ChangeAdjust) {
/* If a step change occurs, just shift all raw time stamps by the offset */
for (ptr = timer_queue.next; ptr != &timer_queue; ptr = ptr->next) {
static void
slew_sources(struct timeval *raw, struct timeval *cooked, double dfreq,
- double doffset, int is_step_change, void *anything);
+ double doffset, LCL_ChangeType change_type, void *anything);
static void
add_dispersion(double dispersion, void *anything);
static char *
struct timeval *cooked,
double dfreq,
double doffset,
- int is_step_change,
+ LCL_ChangeType change_type,
void *anything)
{
int i;
static void
handle_step(struct timeval *raw, struct timeval *cooked, double dfreq,
- double doffset, int is_step_change, void *anything)
+ double doffset, LCL_ChangeType change_type, void *anything)
{
- if (is_step_change)
+ if (change_type == LCL_ChangeStep)
UTI_AddDoubleToTimeval(&slew_start, -doffset, &slew_start);
}