can-recv-example: fix printf format for timeval with _TIME_BITS=64

With _TIME_BITS=64, tv_sec and tv_usec are long long integer types,
so update %ld to %llu and cast to (unsigned long long) to fix timestamp
formatting.

https://onedigi.atlassian.net/browse/DEL-9638

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
Javier Viguera 2025-06-18 14:47:35 +02:00
parent e6b2ef0fbf
commit 2e2aac99f1
1 changed files with 2 additions and 2 deletions

View File

@ -124,12 +124,12 @@ static void can_rx_callback(struct canfd_frame *frame, struct timeval *tv)
if (prn_msg_info) {
printf(
" - Time: %ld.%06ld\n"
" - Time: %llu.%06llu\n"
" - Type: %s\n"
" - ID: %x\n"
" - Data length: %u\n"
" - Data: "
,tv->tv_sec, tv->tv_usec, ldx_can_is_extid_frame(frame) ?
, (unsigned long long)tv->tv_sec, (unsigned long long)tv->tv_usec, ldx_can_is_extid_frame(frame) ?
"Extended ID" : "Standard ID", ldx_can_get_id(frame), frame->len);
for (i=0;i<frame->len;i++) {