mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 16:35:06 -05:00
Validate leap status in refclock samples
This commit is contained in:
14
refclock.c
14
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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user