Subject: pkg/22102: ttcp calculates line speed wrong.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <ragge@ludd.luth.se>
List: netbsd-bugs
Date: 07/09/2003 10:33:32
>Number:         22102
>Category:       pkg
>Synopsis:       ttcp calculates line speed wrong.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 09 08:34:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        NetBSD 1.6Q
>Organization:
---------------------------------------------------------------------------
- Anders Magnusson - ragge@ludd.luth.se - Luleå Academic Computer Society -
-                    May the carrier be with you!                         -
>Environment:
	
	
System: NetBSD speedy 1.6Q NetBSD 1.6Q (GENERIC) #0: Tue Apr 8 07:45:42 UTC 2003 autobuild@cs20.apochromatic.org:/autobuilder/build/HEAD/alpha/OBJ/autobuilder/build/HEAD/src/sys/arch/alpha/compile/GENERIC alpha
Architecture: alpha
Machine: alpha
>Description:
	pkgsrc/benchmarks/ttcp calculates the line speed wrong.
	When dealing with line speeds, Kbit is 1000, not 1024; Mbit
	is 1000000, not 1048576 etc, but ttcp uses multiples of 1024
	to get the line speed.
>How-To-Repeat:
	Just try ttcp.
>Fix:
	The following patch (to the patched pkgsrc ttcp.c) fixes the bug:


--- ttcp.c.org	2003-07-09 10:18:53.000000000 +0200
+++ ttcp.c	2003-07-09 10:20:44.000000000 +0200
@@ -490,13 +490,13 @@
 	    sprintf(obuf, "%.2f MB", b / 1024.0 / 1024.0);
 	    break;
 	case 'g':
-	    sprintf(obuf, "%.2f Gbit", b * 8.0 / 1024.0 / 1024.0 / 1024.0);
+	    sprintf(obuf, "%.2f Gbit", b * 8.0 / 1000.0 / 1000.0 / 1000.0);
 	    break;
 	case 'k':
-	    sprintf(obuf, "%.2f Kbit", b * 8.0 / 1024.0);
+	    sprintf(obuf, "%.2f Kbit", b * 8.0 / 1000.0);
 	    break;
 	case 'm':
-	    sprintf(obuf, "%.2f Mbit", b * 8.0 / 1024.0 / 1024.0);
+	    sprintf(obuf, "%.2f Mbit", b * 8.0 / 1000.0 / 1000.0);
 	    break;
     }
     return obuf;
>Release-Note:
>Audit-Trail:
>Unformatted: