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:
Miroslav Lichvar
2016-03-30 17:39:14 +02:00
parent 81f440a882
commit 8fe5e9cf1e
6 changed files with 26 additions and 6 deletions

View File

@@ -45,6 +45,7 @@
static int are_we_synchronised;
static int enable_local_stratum;
static int local_stratum;
static int local_orphan;
static double local_distance;
static NTP_Leap our_leap_status;
static int our_leap_sec;
@@ -236,7 +237,7 @@ REF_Initialise(void)
correction_time_ratio = CNF_GetCorrectionTimeRatio();
enable_local_stratum = CNF_AllowLocalReference(&local_stratum, &local_distance);
enable_local_stratum = CNF_AllowLocalReference(&local_stratum, &local_orphan, &local_distance);
local_timeout_id = 0;
leap_timeout_id = 0;
@@ -1274,6 +1275,16 @@ REF_GetOurStratum(void)
/* ================================================== */
int
REF_GetOrphanStratum(void)
{
if (!enable_local_stratum || !local_orphan)
return NTP_MAX_STRATUM;
return local_stratum;
}
/* ================================================== */
double
REF_GetSkew(void)
{