]>
Commit | Line | Data |
---|---|---|
aa63c42e PS |
1 | --- iproute2/tc/tc_util.c.orig 2000-04-16 19:42:55.000000000 +0200 |
2 | +++ iproute2/tc/tc_util.c 2004-05-13 10:20:19.438544176 +0200 | |
3 | @@ -108,13 +108,13 @@ | |
4 | ||
5 | if (*p) { | |
6 | if (strcasecmp(p, "kbps") == 0) | |
7 | - bps *= 1024; | |
8 | + bps *= 1000; | |
9 | else if (strcasecmp(p, "mbps") == 0) | |
10 | - bps *= 1024*1024; | |
11 | + bps *= 1000*1000; | |
12 | else if (strcasecmp(p, "mbit") == 0) | |
13 | - bps *= 1024*1024/8; | |
14 | + bps *= 1000*1000/8; | |
15 | else if (strcasecmp(p, "kbit") == 0) | |
16 | - bps *= 1024/8; | |
17 | + bps *= 1000/8; | |
18 | else if (strcasecmp(p, "bps") != 0) | |
19 | return -1; | |
20 | } else | |
21 | @@ -158,10 +158,10 @@ | |
22 | { | |
23 | double tmp = (double)rate*8; | |
24 | ||
25 | - if (tmp >= 1024*1023 && fabs(1024*1024*rint(tmp/(1024*1024)) - tmp) < 1024) | |
26 | - snprintf(buf, len, "%gMbit", rint(tmp/(1024*1024))); | |
27 | - else if (tmp >= 1024-16 && fabs(1024*rint(tmp/1024) - tmp) < 16) | |
28 | - snprintf(buf, len, "%gKbit", rint(tmp/1024)); | |
29 | + if (tmp >= 1000*999 && fabs(1000*1000*rint(tmp/(1000*1000)) - tmp) < 1000) | |
30 | + snprintf(buf, len, "%gMbit", rint(tmp/(1000*1000))); | |
31 | + else if (tmp >= 1000-10 && fabs(1000*rint(tmp/1000) - tmp) < 10) | |
32 | + snprintf(buf, len, "%gKbit", rint(tmp/1000)); | |
33 | else | |
34 | snprintf(buf, len, "%ubps", rate); | |
35 | return 0; |