Miroslav Lichvar
2012-09-19 11:34:34 UTC
Signed-off-by: Miroslav Lichvar <***@redhat.com>
---
phc2sys.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/phc2sys.c b/phc2sys.c
index a035be8..dec4c01 100644
--- a/phc2sys.c
+++ b/phc2sys.c
@@ -91,10 +91,6 @@ static int read_phc(clockid_t clkid, clockid_t sysclk, int rdelay, int readings,
int i;
int64_t interval, best_interval = INT64_MAX;
- if (clkid == CLOCK_INVALID) {
- return 0;
- }
-
/* Pick the quickest clkid reading. */
for (i = 0; i < readings; i++) {
if (clock_gettime(sysclk, &tdst1) ||
@@ -300,9 +296,11 @@ int main(int argc, char *argv[])
} else
usleep(1000000 / phc_rate);
- if (!read_phc(src, dst, rdelay, phc_readings, &phc_offset, &phc_ts))
- continue;
- printf("phc %9lld ", phc_offset);
+ if (src != CLOCK_INVALID) {
+ if (!read_phc(src, dst, rdelay, phc_readings, &phc_offset, &phc_ts))
+ continue;
+ printf("phc %9lld ", phc_offset);
+ }
if (fd > 0)
do_servo(&servo, src, dst, pps_offset, pps_ts, kp, ki);
---
phc2sys.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/phc2sys.c b/phc2sys.c
index a035be8..dec4c01 100644
--- a/phc2sys.c
+++ b/phc2sys.c
@@ -91,10 +91,6 @@ static int read_phc(clockid_t clkid, clockid_t sysclk, int rdelay, int readings,
int i;
int64_t interval, best_interval = INT64_MAX;
- if (clkid == CLOCK_INVALID) {
- return 0;
- }
-
/* Pick the quickest clkid reading. */
for (i = 0; i < readings; i++) {
if (clock_gettime(sysclk, &tdst1) ||
@@ -300,9 +296,11 @@ int main(int argc, char *argv[])
} else
usleep(1000000 / phc_rate);
- if (!read_phc(src, dst, rdelay, phc_readings, &phc_offset, &phc_ts))
- continue;
- printf("phc %9lld ", phc_offset);
+ if (src != CLOCK_INVALID) {
+ if (!read_phc(src, dst, rdelay, phc_readings, &phc_offset, &phc_ts))
+ continue;
+ printf("phc %9lld ", phc_offset);
+ }
if (fd > 0)
do_servo(&servo, src, dst, pps_offset, pps_ts, kp, ki);
--
1.7.7.6
1.7.7.6