Community discussions

MikroTik App
 
LansoirThemtq
just joined
Topic Author
Posts: 5
Joined: Thu Jan 26, 2023 10:46 am

speed values are not showing decimal places

Thu Mar 02, 2023 8:48 am

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"];
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: speed values are not showing decimal places

Thu Mar 02, 2023 3:10 pm

RouterOS do not support at all decimal values, only signed 64 bit integer only.

Who is online

Users browsing this forum: Kanzler and 22 guests