mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-07 00:15:07 -05:00
reference: add new leap second handling modes
In addition to the system driver handling add new modes to slew or step the system clock for leap second, or ignore it completely. This can be configured with leapsecmode directive.
This commit is contained in:
31
conf.c
31
conf.c
@@ -63,6 +63,7 @@ static void parse_deny(char *);
|
||||
static void parse_fallbackdrift(char *);
|
||||
static void parse_include(char *);
|
||||
static void parse_initstepslew(char *);
|
||||
static void parse_leapsecmode(char *);
|
||||
static void parse_local(char *);
|
||||
static void parse_log(char *);
|
||||
static void parse_mailonchange(char *);
|
||||
@@ -193,6 +194,9 @@ static double tempcomp_T0, tempcomp_k0, tempcomp_k1, tempcomp_k2;
|
||||
static int sched_priority = 0;
|
||||
static int lock_memory = 0;
|
||||
|
||||
/* Leap second handling mode */
|
||||
static REF_LeapMode leapsec_mode = REF_LeapModeSystem;
|
||||
|
||||
/* Name of a system timezone containing leap seconds occuring at midnight */
|
||||
static char *leapsec_tz = NULL;
|
||||
|
||||
@@ -440,6 +444,8 @@ CNF_ParseLine(const char *filename, int number, char *line)
|
||||
parse_initstepslew(p);
|
||||
} else if (!strcasecmp(command, "keyfile")) {
|
||||
parse_string(p, &keys_file);
|
||||
} else if (!strcasecmp(command, "leapsecmode")) {
|
||||
parse_leapsecmode(p);
|
||||
} else if (!strcasecmp(command, "leapsectz")) {
|
||||
parse_string(p, &leapsec_tz);
|
||||
} else if (!strcasecmp(command, "linux_freq_scale")) {
|
||||
@@ -830,6 +836,23 @@ parse_initstepslew(char *line)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
static void
|
||||
parse_leapsecmode(char *line)
|
||||
{
|
||||
if (!strcasecmp(line, "system"))
|
||||
leapsec_mode = REF_LeapModeSystem;
|
||||
else if (!strcasecmp(line, "slew"))
|
||||
leapsec_mode = REF_LeapModeSlew;
|
||||
else if (!strcasecmp(line, "step"))
|
||||
leapsec_mode = REF_LeapModeStep;
|
||||
else if (!strcasecmp(line, "ignore"))
|
||||
leapsec_mode = REF_LeapModeIgnore;
|
||||
else
|
||||
command_parse_error();
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
static void
|
||||
parse_clientloglimit(char *line)
|
||||
{
|
||||
@@ -1664,6 +1687,14 @@ CNF_GetPidFile(void)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
REF_LeapMode
|
||||
CNF_GetLeapSecMode(void)
|
||||
{
|
||||
return leapsec_mode;
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
char *
|
||||
CNF_GetLeapSecTimezone(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user