From 8f5582f85a81ff23f83afe4a06aa5f02fe5e9dac Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Mon, 5 Sep 2022 02:22:42 -0500 Subject: [PATCH] Fix more percent calculations (#14294) --- includes/html/api_functions.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/html/api_functions.inc.php b/includes/html/api_functions.inc.php index 851e2f99f9..4932d8c82c 100644 --- a/includes/html/api_functions.inc.php +++ b/includes/html/api_functions.inc.php @@ -194,8 +194,8 @@ function get_port_stats_by_port_hostname(Illuminate\Http\Request $request) $out_rate = $port['ifOutOctets_rate'] * 8; $port['in_rate'] = Number::formatSi($in_rate, 2, 3, 'bps'); $port['out_rate'] = Number::formatSi($out_rate, 2, 3, 'bps'); - $port['in_perc'] = number_format($in_rate / $port['ifSpeed'] * 100, 2, '.', ''); - $port['out_perc'] = number_format($out_rate / $port['ifSpeed'] * 100, 2, '.', ''); + $port['in_perc'] = Number::calculatePercent($in_rate, $port['ifSpeed']); + $port['out_perc'] = Number::calculatePercent($out_rate, $port['ifSpeed']); $port['in_pps'] = Number::formatBi($port['ifInUcastPkts_rate'], 2, 3, ''); $port['out_pps'] = Number::formatBi($port['ifOutUcastPkts_rate'], 2, 3, '');