Page 1 of 1

speed values are not showing decimal places

Posted: Thu Mar 02, 2023 8:48 am
by LansoirThemtq
Using the RouterOS API, I was able to retrieve the download and upload speed of a server. However, the speed values are not showing decimal places; for instance, 92.248428 is being saved as 92248428.000. Does anyone know how to resolve this issue? The code I have used is provided below:

$API->write('/tool/bandwidth-test',false);
$API->write("=address=$B_server",false);
$API->write("=user=$B_username",false);
$API->write("=password=$B_password",false);
$API->write("=direction=receive",false);
$API->write("=duration=10s",false);
$API->write("=protocol=tcp",true);

$read = $API->read();
$rxAverage = $read[9]["rx-total-average"];
echo ("-------------------");
echo $rxAverage;
echo ("-------------------");
$result = print_r($read,true);

$API->write('/tool/bandwidth-test',false);
$API->write("=address=$B_server",false);
$API->write("=user=$B_username",false);
$API->write("=password=$B_password",false);
$API->write("=direction=transmit",false);
$API->write("=duration=10s",false);
$API->write("=protocol=tcp",true);

$read1 = $API->read();
$txAverage1 = $read1[9]["tx-total-average"];

Re: speed values are not showing decimal places

Posted: Thu Mar 02, 2023 3:10 pm
by rextended
RouterOS do not support at all decimal values, only signed 64 bit integer only.