mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 16:55:07 -05:00
reference: add orphan mode to local reference
Add orphan option to the local directive. It will enable an orphan mode compatible with ntpd.
This commit is contained in:
@@ -224,13 +224,14 @@ CPS_ParseNTPSourceAdd(char *line, CPS_NTP_Source *src)
|
||||
/* ================================================== */
|
||||
|
||||
int
|
||||
CPS_ParseLocal(char *line, int *stratum, double *distance)
|
||||
CPS_ParseLocal(char *line, int *stratum, int *orphan, double *distance)
|
||||
{
|
||||
int n;
|
||||
char *cmd;
|
||||
|
||||
*stratum = 10;
|
||||
*distance = 1.0;
|
||||
*orphan = 0;
|
||||
|
||||
while (*line) {
|
||||
cmd = line;
|
||||
@@ -239,6 +240,9 @@ CPS_ParseLocal(char *line, int *stratum, double *distance)
|
||||
if (!strcasecmp(cmd, "stratum")) {
|
||||
if (sscanf(line, "%d%n", stratum, &n) != 1)
|
||||
return 0;
|
||||
} else if (!strcasecmp(cmd, "orphan")) {
|
||||
*orphan = 1;
|
||||
n = 0;
|
||||
} else if (!strcasecmp(cmd, "distance")) {
|
||||
if (sscanf(line, "%lf%n", distance, &n) != 1)
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user