From 09fdc45220110d29e6952b3ba0190c6889db8557 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Tue, 5 Feb 2013 17:36:04 +0100 Subject: [PATCH] phc2sys: Add option to set step threshold. Signed-off-by: Miroslav Lichvar --- phc2sys.8 | 6 ++++++ phc2sys.c | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/phc2sys.8 b/phc2sys.8 index e26641a..58d0b49 100644 --- a/phc2sys.8 +++ b/phc2sys.8 @@ -81,6 +81,12 @@ Specify the proportional constant of the PI controller. The default is 0.7. .BI \-I " ki" Specify the integral constant of the PI controller. The default is 0.3. .TP +.BI \-S " step" +Specify the step threshold of the PI controller. It is the maximum offset that +the controller corrects by changing the clock frequency instead of stepping the +clock. The clock is always stepped on start. The value of 0.0 disables stepping +after the start. The default is 0.0. +.TP .BI \-R " update-rate" Specify the slave clock update rate when running in the direct synchronization mode. The default is 1 per second. diff --git a/phc2sys.c b/phc2sys.c index 8e6b79f..5b8a28b 100644 --- a/phc2sys.c +++ b/phc2sys.c @@ -420,6 +420,7 @@ static void usage(char *progname) " -i [iface] master clock by network interface\n" " -P [kp] proportional constant (0.7)\n" " -I [ki] integration constant (0.3)\n" + " -S [step] step threshold (disabled)\n" " -R [rate] slave clock update rate in HZ (1)\n" " -N [num] number of master clock readings per update (5)\n" " -O [offset] slave-master time offset (0)\n" @@ -448,7 +449,7 @@ int main(int argc, char *argv[]) /* Process the command line arguments. */ progname = strrchr(argv[0], '/'); progname = progname ? 1+progname : argv[0]; - while (EOF != (c = getopt(argc, argv, "c:d:hs:P:I:R:N:O:i:wv"))) { + while (EOF != (c = getopt(argc, argv, "c:d:hs:P:I:S:R:N:O:i:wv"))) { switch (c) { case 'c': dst_clock.clkid = clock_open(optarg); @@ -465,6 +466,9 @@ int main(int argc, char *argv[]) case 'I': configured_pi_ki = atof(optarg); break; + case 'S': + configured_pi_offset = atof(optarg); + break; case 'R': phc_rate = atoi(optarg); break;