From 73968920fe2afca13504f632f46ea60530fcac15 Mon Sep 17 00:00:00 2001 From: Igor Moskovtsev Date: Thu, 16 May 2024 16:05:02 +0300 Subject: [PATCH] clients/ppscheck.c: Fix -x,--seconds option. Option doesn't work if time_pps_fetch() timed out. --- clients/ppscheck.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/clients/ppscheck.c b/clients/ppscheck.c index 8f078ebf9..db9b5de22 100644 --- a/clients/ppscheck.c +++ b/clients/ppscheck.c @@ -212,6 +212,12 @@ static void do_kpps(void) time_t now; char ts_str[TIMESPEC_LEN]; + now = time(NULL); + if (0 < exit_timer && + now >= exit_timer) { + break; + } + kpps_tv.tv_sec = 3; // 3 second timeout kpps_tv.tv_nsec = 0; @@ -229,11 +235,6 @@ static void do_kpps(void) strerror(errno), errno); exit(EXIT_FAILURE); } - now = time(NULL); - if (0 < exit_timer && - now >= exit_timer) { - break; - } // new second, output a newline. if (last != now) { (void)putchar('\n'); -- 2.39.3