From 24a1a6a81ea530e9cf65ebf8226520739bd3df00 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Thu, 17 Jan 2013 18:31:40 +0100 Subject: [PATCH] phc2sys: allow PPS loop only with system clock. The PPS time stamps are always made by the system clock, don't allow running the PPS loop with other clocks. Signed-off-by: Miroslav Lichvar --- phc2sys.8 | 3 ++- phc2sys.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/phc2sys.8 b/phc2sys.8 index adce4ad..a5051c8 100644 --- a/phc2sys.8 +++ b/phc2sys.8 @@ -54,7 +54,8 @@ should be already close to the correct time before .B phc2sys is started or the .B \-s -option should be used too. +option should be used too. This option can be used only with the system clock as +the slave clock. .TP .BI \-s " phc-device" Specify the master clock by device (e.g. /dev/ptp0) or name (e.g. CLOCK_REALTIME diff --git a/phc2sys.c b/phc2sys.c index 1c0d8b2..988a3f0 100644 --- a/phc2sys.c +++ b/phc2sys.c @@ -378,7 +378,8 @@ int main(int argc, char *argv[]) src = clock_open(phc_device); } if (!(device || src != CLOCK_INVALID) || - dst_clock.clkid == CLOCK_INVALID) { + dst_clock.clkid == CLOCK_INVALID || + (device && dst_clock.clkid != CLOCK_REALTIME)) { usage(progname); return -1; }