diff --git a/refclock.c b/refclock.c index 0f8a64c..86feac7 100644 --- a/refclock.c +++ b/refclock.c @@ -338,7 +338,7 @@ RCL_GetDriverOption(RCL_Instance instance, char *name) } int -RCL_AddSample(RCL_Instance instance, struct timeval *sample_time, double offset, NTP_Leap leap_status) +RCL_AddSample(RCL_Instance instance, struct timeval *sample_time, double offset, int leap) { double correction, dispersion; struct timeval cooked_time; @@ -351,7 +351,17 @@ RCL_AddSample(RCL_Instance instance, struct timeval *sample_time, double offset, return 0; filter_add_sample(&instance->filter, &cooked_time, offset - correction + instance->offset, dispersion); - instance->leap_status = leap_status; + + switch (leap) { + case LEAP_Normal: + case LEAP_InsertSecond: + case LEAP_DeleteSecond: + instance->leap_status = leap; + break; + default: + instance->leap_status = LEAP_Unsynchronised; + break; + } log_sample(instance, &cooked_time, 0, 0, offset, offset - correction + instance->offset, dispersion); diff --git a/refclock.h b/refclock.h index fa90337..ba2442b 100644 --- a/refclock.h +++ b/refclock.h @@ -66,7 +66,7 @@ extern void RCL_SetDriverData(RCL_Instance instance, void *data); extern void *RCL_GetDriverData(RCL_Instance instance); extern char *RCL_GetDriverParameter(RCL_Instance instance); extern char *RCL_GetDriverOption(RCL_Instance instance, char *name); -extern int RCL_AddSample(RCL_Instance instance, struct timeval *sample_time, double offset, NTP_Leap leap_status); +extern int RCL_AddSample(RCL_Instance instance, struct timeval *sample_time, double offset, int leap); extern int RCL_AddPulse(RCL_Instance instance, struct timeval *pulse_time, double second); #endif