Validate leap status in refclock samples
This commit is contained in:
parent
1b8547059a
commit
934d4e04b5
2 changed files with 13 additions and 3 deletions
14
refclock.c
14
refclock.c
|
@ -338,7 +338,7 @@ RCL_GetDriverOption(RCL_Instance instance, char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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;
|
double correction, dispersion;
|
||||||
struct timeval cooked_time;
|
struct timeval cooked_time;
|
||||||
|
@ -351,7 +351,17 @@ RCL_AddSample(RCL_Instance instance, struct timeval *sample_time, double offset,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
filter_add_sample(&instance->filter, &cooked_time, offset - correction + instance->offset, dispersion);
|
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);
|
log_sample(instance, &cooked_time, 0, 0, offset, offset - correction + instance->offset, dispersion);
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ extern void RCL_SetDriverData(RCL_Instance instance, void *data);
|
||||||
extern void *RCL_GetDriverData(RCL_Instance instance);
|
extern void *RCL_GetDriverData(RCL_Instance instance);
|
||||||
extern char *RCL_GetDriverParameter(RCL_Instance instance);
|
extern char *RCL_GetDriverParameter(RCL_Instance instance);
|
||||||
extern char *RCL_GetDriverOption(RCL_Instance instance, char *name);
|
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);
|
extern int RCL_AddPulse(RCL_Instance instance, struct timeval *pulse_time, double second);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue