From 66af3b280548660ef65fa2c3331c37a56523339f Mon Sep 17 00:00:00 2001 From: Jean-Roland Date: Wed, 20 Dec 2023 10:19:33 +0100 Subject: [PATCH] fix: convert type before divide operation --- examples/unix/c11/z_sub_thr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/unix/c11/z_sub_thr.c b/examples/unix/c11/z_sub_thr.c index 6cddc4acb..676d37d9c 100644 --- a/examples/unix/c11/z_sub_thr.c +++ b/examples/unix/c11/z_sub_thr.c @@ -53,7 +53,7 @@ void on_sample(const z_sample_t *sample, void *context) { stats->finished_rounds++; unsigned long elapsed_ms = z_clock_elapsed_ms(&stats->start); printf("Received %d msg in %lu ms (%.1f msg/s)\n", PACKET_NB, elapsed_ms, - (double)(PACKET_NB * 1000 / elapsed_ms)); + (double)(PACKET_NB * 1000) / (double)elapsed_ms); stats->count = 0; } } @@ -63,7 +63,7 @@ void drop_stats(void *context) { unsigned long elapsed_ms = z_clock_elapsed_ms(&stats->first_start); const unsigned long sent_messages = PACKET_NB * stats->finished_rounds + stats->count; printf("Stats after unsubscribing: received %ld messages over %lu miliseconds (%.1f msg/s)\n", sent_messages, - elapsed_ms, (double)(sent_messages * 1000 / elapsed_ms)); + elapsed_ms, (double)(sent_messages * 1000) / (double)elapsed_ms); free(context); }