sources: add minsources option

This sets the minimum number of selectable sources needed to update the
local clock.
This commit is contained in:
Miroslav Lichvar
2014-10-20 17:46:33 +02:00
parent 6744ad392d
commit 1bb2732056
4 changed files with 39 additions and 2 deletions

13
conf.c
View File

@@ -135,6 +135,9 @@ static double make_step_threshold = 0.0;
/* Threshold for automatic RTC trimming */
static double rtc_autotrim_threshold = 0.0;
/* Minimum number of selectables sources required to update the clock */
static int min_sources = 1;
/* Number of updates before offset checking, number of ignored updates
before exiting and the maximum allowed offset */
static int max_offset_delay = -1;
@@ -456,6 +459,8 @@ CNF_ParseLine(const char *filename, int number, char *line)
parse_double(p, &max_update_skew);
} else if (!strcasecmp(command, "minsamples")) {
parse_int(p, &min_samples);
} else if (!strcasecmp(command, "minsources")) {
parse_int(p, &min_sources);
} else if (!strcasecmp(command, "noclientlog")) {
no_client_log = parse_null(p);
} else if (!strcasecmp(command, "peer")) {
@@ -1700,6 +1705,14 @@ CNF_GetMinSamples(void)
/* ================================================== */
int
CNF_GetMinSources(void)
{
return min_sources;
}
/* ================================================== */
char *
CNF_GetHwclockFile(void)
{