Skip to content

Commit

Permalink
Fix verbose of check_clocks for 32 bit systems
Browse files Browse the repository at this point in the history
On 32 bit systems uint64_t is long long unsigned int and thus
requires %llu in printf to prevent garbled output. Use
PRIu64/PRId64 to handle this correctly for both 32 bit and
64 bit systems.

Signed-off-by: Florian Kauer <[email protected]>
  • Loading branch information
koalo committed Mar 9, 2023
1 parent 722928b commit b35b0a9
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions misc/check_clocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <byteswap.h>
#include <errno.h>
#include <stdbool.h>
#include <inttypes.h>

#define ONE_SEC 1000000000LL
/*
Expand Down Expand Up @@ -407,14 +408,14 @@ static int check_local_clock(char *ifname, int verbose)
phc_tai = ptp - tai;

if (verbose) {
printf("rt tstamp:\t%lu\n", rt);
printf("tai tstamp:\t%lu\n", tai);
printf("phc tstamp:\t%lu\n", ptp);
printf("rt latency:\t%lu\n", lat_rt);
printf("tai latency:\t%lu\n", lat_tai);
printf("phc latency:\t%lu\n", lat_ptp);
printf("phc-rt delta:\t%ld\n", phc_rt);
printf("phc-tai delta:\t%ld\n\n", phc_tai);
printf("rt tstamp:\t%"PRIu64"\n", rt);
printf("tai tstamp:\t%"PRIu64"\n", tai);
printf("phc tstamp:\t%"PRIu64"\n", ptp);
printf("rt latency:\t%"PRIu64"\n", lat_rt);
printf("tai latency:\t%"PRIu64"\n", lat_tai);
printf("phc latency:\t%"PRIu64"\n", lat_ptp);
printf("phc-rt delta:\t%"PRId64"\n", phc_rt);
printf("phc-tai delta:\t%"PRId64"\n\n", phc_tai);
}

if (llabs(phc_rt - UTC_OFFSET * ONE_SEC) >= 50000) {
Expand Down

0 comments on commit b35b0a9

Please sign in to comment.