diff options
author | Christian Eggers <ceggers@arri.de> | 2022-09-23 12:51:40 +0200 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2022-09-26 10:57:00 -0700 |
commit | fa8411cf37a3955e187824cc84235dd6ae76524d (patch) | |
tree | 4d12ee636373be2eaab0d854e486bdca9641b47e /monitor | |
parent | 7b07f1f980598cf54c91642e6583613bd6185eb1 (diff) | |
download | bluez-fa8411cf37a3955e187824cc84235dd6ae76524d.tar.gz |
monitor: fix printf format strings
time_t is 64 bit (long long) on many 32 bit platforms (e.g. ARM) now
Diffstat (limited to 'monitor')
-rw-r--r-- | monitor/analyze.c | 21 | ||||
-rw-r--r-- | monitor/packet.c | 10 |
2 files changed, 18 insertions, 13 deletions
diff --git a/monitor/analyze.c b/monitor/analyze.c index ac23e13bb..50e7e5542 100644 --- a/monitor/analyze.c +++ b/monitor/analyze.c @@ -172,15 +172,18 @@ static void conn_destroy(void *data) print_field("%lu RX packets", conn->rx_num); print_field("%lu TX packets", conn->tx_num); print_field("%lu TX completed packets", conn->tx_num_comp); - print_field("%ld msec min latency", - conn->tx_lat_min.tv_sec * 1000 + - conn->tx_lat_min.tv_usec / 1000); - print_field("%ld msec max latency", - conn->tx_lat_max.tv_sec * 1000 + - conn->tx_lat_max.tv_usec / 1000); - print_field("%ld msec median latency", - conn->tx_lat_med.tv_sec * 1000 + - conn->tx_lat_med.tv_usec / 1000); + print_field("%lld msec min latency", + (long long) + (conn->tx_lat_min.tv_sec * 1000 + + conn->tx_lat_min.tv_usec / 1000)); + print_field("%lld msec max latency", + (long long) + (conn->tx_lat_max.tv_sec * 1000 + + conn->tx_lat_max.tv_usec / 1000)); + print_field("%lld msec median latency", + (long long) + (conn->tx_lat_med.tv_sec * 1000 + + conn->tx_lat_med.tv_usec / 1000)); print_field("%u octets TX min packet size", conn->tx_pkt_min); print_field("%u octets TX max packet size", conn->tx_pkt_max); print_field("%u octets TX median packet size", conn->tx_pkt_med); diff --git a/monitor/packet.c b/monitor/packet.c index 1344fd5b2..1a41498e9 100644 --- a/monitor/packet.c +++ b/monitor/packet.c @@ -384,8 +384,9 @@ static void print_packet(struct timeval *tv, struct ucred *cred, char ident, } if (filter_mask & PACKET_FILTER_SHOW_TIME) { - n = sprintf(ts_str + ts_pos, " %02d:%02d:%02d.%06lu", - tm.tm_hour, tm.tm_min, tm.tm_sec, tv->tv_usec); + n = sprintf(ts_str + ts_pos, " %02d:%02d:%02d.%06llu", + tm.tm_hour, tm.tm_min, tm.tm_sec, + (long long)tv->tv_usec); if (n > 0) { ts_pos += n; ts_len += n; @@ -393,8 +394,9 @@ static void print_packet(struct timeval *tv, struct ucred *cred, char ident, } if (filter_mask & PACKET_FILTER_SHOW_TIME_OFFSET) { - n = sprintf(ts_str + ts_pos, " %lu.%06lu", - tv->tv_sec - time_offset, tv->tv_usec); + n = sprintf(ts_str + ts_pos, " %llu.%06llu", + (long long)(tv->tv_sec - time_offset), + (long long)tv->tv_usec); if (n > 0) { ts_pos += n; ts_len += n; |