diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-03-10 17:49:05 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-03-10 17:49:05 +0100 |
commit | 747694c473ed4a886e7ac4a57bb0f2965674de9a (patch) | |
tree | 39b05a91a933580d47d161fe9e6137b24d55b762 /src/ats-tests | |
parent | 5199de0279e0825285c294a537d17f8ccee8e148 (diff) | |
download | gnunet-747694c473ed4a886e7ac4a57bb0f2965674de9a.tar.gz gnunet-747694c473ed4a886e7ac4a57bb0f2965674de9a.zip |
prevent division by zero
Diffstat (limited to 'src/ats-tests')
-rw-r--r-- | src/ats-tests/gnunet-ats-sim.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/ats-tests/gnunet-ats-sim.c b/src/ats-tests/gnunet-ats-sim.c index 56f8f2223..0f32df511 100644 --- a/src/ats-tests/gnunet-ats-sim.c +++ b/src/ats-tests/gnunet-ats-sim.c | |||
@@ -81,15 +81,19 @@ evaluate (struct GNUNET_TIME_Relative duration_total) | |||
81 | 81 | ||
82 | 82 | ||
83 | duration = (duration_total.rel_value_us / (1000 * 1000)); | 83 | duration = (duration_total.rel_value_us / (1000 * 1000)); |
84 | if (0 == duration) | ||
85 | duration = 1; | ||
84 | for (c_m = 0; c_m < e->num_masters; c_m++) | 86 | for (c_m = 0; c_m < e->num_masters; c_m++) |
85 | { | 87 | { |
86 | mp = &masters_p[c_m]; | 88 | mp = &masters_p[c_m]; |
87 | fprintf (stderr, | 89 | fprintf (stderr, |
88 | _("Master [%u]: sent: %u KiB in %u sec. = %u KiB/s, received: %u KiB in %u sec. = %u KiB/s\n"), | 90 | _("Master [%u]: sent: %u KiB in %u sec. = %u KiB/s, received: %u KiB in %u sec. = %u KiB/s\n"), |
89 | mp->no, mp->total_bytes_sent / 1024, duration, | 91 | mp->no, mp->total_bytes_sent / 1024, |
90 | (mp->total_bytes_sent / 1024) / duration, | 92 | duration, |
91 | mp->total_bytes_received / 1024, duration, | 93 | (mp->total_bytes_sent / 1024) / duration, |
92 | (mp->total_bytes_received / 1024) / duration); | 94 | mp->total_bytes_received / 1024, |
95 | duration, | ||
96 | (mp->total_bytes_received / 1024) / duration); | ||
93 | 97 | ||
94 | for (c_s = 0; c_s < e->num_slaves; c_s++) | 98 | for (c_s = 0; c_s < e->num_slaves; c_s++) |
95 | { | 99 | { |