Skip to content

Commit 048f6d9

Browse files
Binary-Eaterdavem330
authored andcommitted
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 <[email protected]> Cc: Shuah Khan <[email protected]> Cc: Richard Cochran <[email protected]> Cc: Maciek Machnikowski <[email protected]> Signed-off-by: Rahul Rameshbabu <[email protected]> Acked-by: Richard Cochran <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent fe3834c commit 048f6d9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/testing/selftests/ptp/testptp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static long ppb_to_scaled_ppm(int ppb)
110110

111111
static int64_t pctns(struct ptp_clock_time *t)
112112
{
113-
return t->sec * 1000000000LL + t->nsec;
113+
return t->sec * NSEC_PER_SEC + t->nsec;
114114
}
115115

116116
static void usage(char *progname)
@@ -317,7 +317,7 @@ int main(int argc, char *argv[])
317317
tx.time.tv_usec = adjns;
318318
while (tx.time.tv_usec < 0) {
319319
tx.time.tv_sec -= 1;
320-
tx.time.tv_usec += 1000000000;
320+
tx.time.tv_usec += NSEC_PER_SEC;
321321
}
322322

323323
if (clock_adjtime(clkid, &tx) < 0) {

0 commit comments

Comments
 (0)