From a29b3bc4f94aff6b8602af4f342f42d94c5a3f18 Mon Sep 17 00:00:00 2001 From: Libor Pechacek Date: Fri, 17 May 2013 10:55:49 +0200 Subject: [PATCH] phc2sys: Require either -O or -w on command line The default zero offset can lead to misalignment between system clocks or wrong time to be broadcast to the domain. Therefore we require setting offset upon invocation. Signed-off-by: Libor Pechacek --- phc2sys.8 | 8 ++++---- phc2sys.c | 7 +++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/phc2sys.8 b/phc2sys.8 index 43e3abc..92081cf 100644 --- a/phc2sys.8 +++ b/phc2sys.8 @@ -109,10 +109,10 @@ minimize the error caused by random delays in scheduling and bus utilization. The default is 5. .TP .BI \-O " offset" -Specify the offset between the slave and master times in seconds. The default -is set automatically with the -.B \-w -option, 0 otherwise. +Specify the offset between the slave and master times in seconds. See +.SM +.B TIME SCALE USAGE +below. .TP .BI \-u " summary-updates" Specify the number of clock updates included in summary statistics. The diff --git a/phc2sys.c b/phc2sys.c index 1dbe2bc..309ee6c 100644 --- a/phc2sys.c +++ b/phc2sys.c @@ -684,6 +684,13 @@ int main(int argc, char *argv[]) return -1; } + if (!wait_sync && !forced_sync_offset) { + fprintf(stderr, + "time offset must be specified using -w or -O\n"); + usage(progname); + return -1; + } + if (dst_clock.stats_max_count > 0) { dst_clock.offset_stats = stats_create(); dst_clock.freq_stats = stats_create();