From 71f0efb3e3dd4854cb944f66624a1d206df79e68 Mon Sep 17 00:00:00 2001 From: Alex Justesen Date: Sun, 23 Oct 2022 14:21:09 -0400 Subject: [PATCH] When converting bits its to the power of 1000 not 1024 (#70) --- app/helpers.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers.php b/app/helpers.php index f01632ce3..8a22ecfb6 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -4,11 +4,11 @@ function formatBits(int $bits, $precision = 2) { if ($bits > 0) { - $i = floor(log($bits) / log(1024)); + $i = floor(log($bits) / log(1000)); $sizes = ['B', 'Kb', 'Mb', 'Gb', 'Tb', 'Pb', 'Eb', 'Zb', 'Yb']; - return sprintf('%.02F', round($bits / pow(1024, $i), $precision)) * 1 .' '.@$sizes[$i]; + return sprintf('%.02F', round($bits / pow(1000, $i), $precision)) * 1 .' '.@$sizes[$i]; } return 0;