diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2015-05-24 18:01:53 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2015-05-24 18:01:53 +0200 |
commit | b878121e76730f7f7e458180363371dbe10fd253 (patch) | |
tree | 50db982a77bcf13863802e2626443fbf104357e9 /networking/tc.c | |
parent | 9a595bb36ded308e6d4336aef2c1cd3ac738a398 (diff) | |
download | busybox-w32-b878121e76730f7f7e458180363371dbe10fd253.tar.gz busybox-w32-b878121e76730f7f7e458180363371dbe10fd253.tar.bz2 busybox-w32-b878121e76730f7f7e458180363371dbe10fd253.zip |
tc: fix print_rate
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/tc.c')
-rw-r--r-- | networking/tc.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/networking/tc.c b/networking/tc.c index 533f7c042..76e2e8359 100644 --- a/networking/tc.c +++ b/networking/tc.c | |||
@@ -151,17 +151,17 @@ static void print_rate(char *buf, int len, uint32_t rate) | |||
151 | double tmp = (double)rate*8; | 151 | double tmp = (double)rate*8; |
152 | 152 | ||
153 | if (use_iec) { | 153 | if (use_iec) { |
154 | if (tmp >= 1000.0*1024.0*1024.0) | 154 | if (tmp >= 1000*1024*1024) |
155 | snprintf(buf, len, "%.0fMibit", tmp/1024.0*1024.0); | 155 | snprintf(buf, len, "%.0fMibit", tmp/(1024*1024)); |
156 | else if (tmp >= 1000.0*1024) | 156 | else if (tmp >= 1000*1024) |
157 | snprintf(buf, len, "%.0fKibit", tmp/1024); | 157 | snprintf(buf, len, "%.0fKibit", tmp/1024); |
158 | else | 158 | else |
159 | snprintf(buf, len, "%.0fbit", tmp); | 159 | snprintf(buf, len, "%.0fbit", tmp); |
160 | } else { | 160 | } else { |
161 | if (tmp >= 1000.0*1000000.0) | 161 | if (tmp >= 1000*1000000) |
162 | snprintf(buf, len, "%.0fMbit", tmp/1000000.0); | 162 | snprintf(buf, len, "%.0fMbit", tmp/1000000); |
163 | else if (tmp >= 1000.0 * 1000.0) | 163 | else if (tmp >= 1000*1000) |
164 | snprintf(buf, len, "%.0fKbit", tmp/1000.0); | 164 | snprintf(buf, len, "%.0fKbit", tmp/1000); |
165 | else | 165 | else |
166 | snprintf(buf, len, "%.0fbit", tmp); | 166 | snprintf(buf, len, "%.0fbit", tmp); |
167 | } | 167 | } |