PDA

View Full Version : changing speeds output


snatsert
04-10-2006, 10:10 AM
is it possible to change the speedoutput in mbit/sec instead of mbyte/sec ?

neoxed
04-11-2006, 05:18 PM
You would have to edit the FormatSpeed procedure in nxLib.tcl.

I will not add support for this because it is inconsistent with ioFTPD's behavior. ioFTPD displays all speeds in bytes per second (rather than bits), so it would be logical for all scripts to do the same.

snatsert
04-12-2006, 12:38 PM
You would have to edit the FormatSpeed procedure in nxLib.tcl.

I will not add support for this because it is inconsistent with ioFTPD's behavior. ioFTPD displays all speeds in bytes per second (rather than bits), so it would be logical for all scripts to do the same.


someting in this part ??

proc ::nxLib::FormatSpeed {speed {seconds 0}} {
if {$seconds > 0} {set speed [expr {double($speed) / $seconds}]}
foreach decimals {0 2 2} unit {KB/s MB/s GB/s} {
if {abs($speed) < 1024} {break}
set speed [expr {double($speed) / 1024.0}]
}
return [format "%.*f%s" $decimals $speed $unit]

can you tell me what I excactly should change ?

thnx

neoxed
04-12-2006, 02:54 PM
By converting the speed value from bytes to bits (multiply by 8).

proc ::nxLib::FormatSpeed {speed {seconds 0}} {
set speed [expr {double($speed) * 8}]
if {$seconds > 0} {set speed [expr {double($speed) / $seconds}]}
foreach decimals {0 2 2} unit {Kb/s Mb/s Gb/s} {
if {abs($speed) < 1024} {break}
set speed [expr {double($speed) / 1024.0}]
}
return [format "%.*f%s" $decimals $speed $unit]
}

snatsert
04-13-2006, 12:23 PM
I have edited like what you replied .. but doen't work

neoxed
04-13-2006, 02:37 PM
And what the hell does "doesn't work" mean?

ioFTPD caches nxLib.tcl in any existing interpreters, so you may have to restart ioFTPD.

snatsert
04-14-2006, 10:34 AM
It still show the normal speeds outputs like MB/s , and I did restart ioFTPD

neoxed
04-14-2006, 02:22 PM
Then you didn't replace the procedure in nxLib.tcl. It's simple cut&pasting...this couldn't be any simplier.

snatsert
04-15-2006, 06:42 AM
I did that.....