From: Rahul Rameshbabu Date: Mon, 12 Jun 2023 21:14:54 +0000 (-0700) Subject: testptp: Remove magic numbers related to nanosecond to second conversion X-Git-Tag: v6.6.17~4555^2~65^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=048f6d998eacabed143d6524395573f8868a4f34;p=platform%2Fkernel%2Flinux-rpi.git testptp: Remove magic numbers related to nanosecond to second conversion Use existing NSEC_PER_SEC declaration in place of hardcoded magic numbers. Cc: Jakub Kicinski Cc: Shuah Khan Cc: Richard Cochran Cc: Maciek Machnikowski Signed-off-by: Rahul Rameshbabu Acked-by: Richard Cochran Signed-off-by: David S. Miller --- diff --git a/tools/testing/selftests/ptp/testptp.c b/tools/testing/selftests/ptp/testptp.c index cfa9562..36a1ea3 100644 --- a/tools/testing/selftests/ptp/testptp.c +++ b/tools/testing/selftests/ptp/testptp.c @@ -110,7 +110,7 @@ static long ppb_to_scaled_ppm(int ppb) static int64_t pctns(struct ptp_clock_time *t) { - return t->sec * 1000000000LL + t->nsec; + return t->sec * NSEC_PER_SEC + t->nsec; } static void usage(char *progname) @@ -317,7 +317,7 @@ int main(int argc, char *argv[]) tx.time.tv_usec = adjns; while (tx.time.tv_usec < 0) { tx.time.tv_sec -= 1; - tx.time.tv_usec += 1000000000; + tx.time.tv_usec += NSEC_PER_SEC; } if (clock_adjtime(clkid, &tx) < 0) {