mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-07 06:35:07 -05:00
smooth: add option to smooth out only leap seconds
The leaponly option can be used to enable a mode where only leap seconds are smoothed out and normal offset/frequency changes are ignored. This is useful to make the interval in which a leap second is smoothed out constant and allow an NTP client to use multiple leap smearing servers safely.
This commit is contained in:
18
conf.c
18
conf.c
@@ -189,6 +189,7 @@ static char *pidfile;
|
||||
/* Smoothing constants */
|
||||
static double smooth_max_freq = 0.0; /* in ppm */
|
||||
static double smooth_max_wander = 0.0; /* in ppm/s */
|
||||
static int smooth_leap_only = 0;
|
||||
|
||||
/* Temperature sensor, update interval and compensation coefficients */
|
||||
static char *tempcomp_sensor_file = NULL;
|
||||
@@ -1174,11 +1175,23 @@ parse_broadcast(char *line)
|
||||
static void
|
||||
parse_smoothtime(char *line)
|
||||
{
|
||||
check_number_of_args(line, 2);
|
||||
if (get_number_of_args(line) != 3)
|
||||
check_number_of_args(line, 2);
|
||||
|
||||
if (sscanf(line, "%lf %lf", &smooth_max_freq, &smooth_max_wander) != 2) {
|
||||
smooth_max_freq = 0.0;
|
||||
command_parse_error();
|
||||
}
|
||||
|
||||
line = CPS_SplitWord(CPS_SplitWord(line));
|
||||
smooth_leap_only = 0;
|
||||
|
||||
if (*line) {
|
||||
if (!strcasecmp(line, "leaponly"))
|
||||
smooth_leap_only = 1;
|
||||
else
|
||||
command_parse_error();
|
||||
}
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
@@ -1738,10 +1751,11 @@ CNF_GetLockMemory(void)
|
||||
/* ================================================== */
|
||||
|
||||
void
|
||||
CNF_GetSmooth(double *max_freq, double *max_wander)
|
||||
CNF_GetSmooth(double *max_freq, double *max_wander, int *leap_only)
|
||||
{
|
||||
*max_freq = smooth_max_freq;
|
||||
*max_wander = smooth_max_wander;
|
||||
*leap_only = smooth_leap_only;
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
Reference in New Issue
Block a user