From 46a2ccdda9f3fb6134c95327698712af6d675d46 Mon Sep 17 00:00:00 2001 From: Jean-Roland Date: Thu, 11 Jul 2024 17:14:46 +0200 Subject: [PATCH] fix: print timestamp in a portable way --- examples/unix/c11/z_sub_attachment.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/unix/c11/z_sub_attachment.c b/examples/unix/c11/z_sub_attachment.c index 146cf5bb7..f7241eb73 100644 --- a/examples/unix/c11/z_sub_attachment.c +++ b/examples/unix/c11/z_sub_attachment.c @@ -13,6 +13,7 @@ // #include +#include #include #include #include @@ -83,7 +84,7 @@ void data_handler(const z_loaned_sample_t *sample, void *ctx) { // Check timestamp const z_timestamp_t *ts = z_sample_timestamp(sample); if (ts != NULL) { - printf(" with timestamp: %ld\n", z_timestamp_npt64_time(ts)); + printf(" with timestamp: %" PRIu64 "\n", z_timestamp_npt64_time(ts)); } // Check attachment kv_pairs_t kvp = {.current_idx = 0, .len = KVP_LEN, .data = (kv_pair_t *)malloc(KVP_LEN * sizeof(kv_pair_t))};