From 26308c219a290f17c765000889ebf0b504e42719 Mon Sep 17 00:00:00 2001 From: Peter Schneider Date: Sun, 15 Apr 2018 21:13:54 +0200 Subject: [PATCH] phc2sys.c: Sync variable 'node.sanity_freq_limit with cfg item Copy 'node.sanity_freq_limit' to struct config item 'sanity_freq_limit'. Check for 'servo_type' == CLOCK_SERVO_NTPSHM. Signed-off-by: Peter Schneider --- phc2sys.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/phc2sys.c b/phc2sys.c index 04e7442..494ac10 100644 --- a/phc2sys.c +++ b/phc2sys.c @@ -1349,7 +1349,6 @@ int main(int argc, char *argv[]) int ntpshm_segment; double phc_rate, tmp; struct node node = { - .sanity_freq_limit = 200000000, .phc_readings = 5, .phc_interval = 1.0, }; @@ -1445,8 +1444,10 @@ int main(int argc, char *argv[]) node.forced_sync_offset = -1; break; case 'L': - if (get_arg_val_i(c, optarg, &node.sanity_freq_limit, 0, INT_MAX)) + if (get_arg_val_i(c, optarg, &node.sanity_freq_limit, 0, INT_MAX) || + config_set_int(cfg, "sanity_freq_limit", node.sanity_freq_limit)) { goto end; + } break; case 'M': if (get_arg_val_i(c, optarg, &ntpshm_segment, INT_MIN, INT_MAX) || @@ -1548,8 +1549,10 @@ int main(int argc, char *argv[]) node.servo_type = config_get_int(cfg, NULL, "clock_servo"); if (node.servo_type == CLOCK_SERVO_NTPSHM) { config_set_int(cfg, "kernel_leap", 0); + config_set_int(cfg, "sanity_freq_limit", 0); } node.kernel_leap = config_get_int(cfg, NULL, "kernel_leap"); + node.sanity_freq_limit = config_get_int(cfg, NULL, "sanity_freq_limit"); if (autocfg) { if (init_pmc(cfg, &node))