mirror of
https://gitlab.com/chrony/chrony.git
synced 2026-01-20 21:00:20 -05:00
Add option to trim RTC automatically
This commit is contained in:
25
conf.c
25
conf.c
@@ -90,6 +90,7 @@ static void parse_pidfile(char *);
|
||||
static void parse_port(char *);
|
||||
static void parse_refclock(char *);
|
||||
static void parse_reselectdist(char *);
|
||||
static void parse_rtcautotrim(char *);
|
||||
static void parse_rtcdevice(char *);
|
||||
static void parse_rtcfile(char *);
|
||||
static void parse_rtconutc(char *);
|
||||
@@ -158,6 +159,9 @@ static int rtc_sync = 0;
|
||||
static int make_step_limit = 0;
|
||||
static double make_step_threshold = 0.0;
|
||||
|
||||
/* Threshold for automatic RTC trimming */
|
||||
static double rtc_autotrim_threshold = 0.0;
|
||||
|
||||
/* Number of updates before offset checking, number of ignored updates
|
||||
before exiting and the maximum allowed offset */
|
||||
static int max_offset_delay = -1;
|
||||
@@ -441,6 +445,8 @@ CNF_ReadFile(const char *filename)
|
||||
parse_refclock(p);
|
||||
} else if (!strcasecmp(command, "reselectdist")) {
|
||||
parse_reselectdist(p);
|
||||
} else if (!strcasecmp(command, "rtcautotrim")) {
|
||||
parse_rtcautotrim(p);
|
||||
} else if (!strcasecmp(command, "rtcdevice")) {
|
||||
parse_rtcdevice(p);
|
||||
} else if (!strcasecmp(command, "rtcfile")) {
|
||||
@@ -789,6 +795,17 @@ parse_keyfile(char *line)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
static void
|
||||
parse_rtcautotrim(char *line)
|
||||
{
|
||||
check_number_of_args(line, 1);
|
||||
if (sscanf(line, "%lf", &rtc_autotrim_threshold) != 1) {
|
||||
command_parse_error();
|
||||
}
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
static void
|
||||
parse_rtcfile(char *line)
|
||||
{
|
||||
@@ -1586,6 +1603,14 @@ CNF_GetKeysFile(void)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
double
|
||||
CNF_GetRtcAutotrim(void)
|
||||
{
|
||||
return rtc_autotrim_threshold;
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
char *
|
||||
CNF_GetRtcFile(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user