From 00fa7904a95ddbaee82d0fe482d53f113b3a81a6 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Thu, 24 Dec 2015 13:08:16 -0200 Subject: [PATCH] bytes, not bits --- js/twister_network.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/js/twister_network.js b/js/twister_network.js index 3dec7bd..f4cc255 100644 --- a/js/twister_network.js +++ b/js/twister_network.js @@ -23,11 +23,11 @@ function formatDecimal(value) { return Math.round(value * scale) / scale; } function formatSize(value) { - if (value<1024) return value + ' b'; - if (value<1024*1024) return formatDecimal(value/1024) + ' Kb'; - if (value<1024*1024*1024) return formatDecimal(value/(1024*1024)) + ' Mb'; - if (value<1024*1024*1024*1024) return formatDecimal(value/(1024*1024*1024)) + ' Gb'; - return formatDecimal(value/(1024*1024*1024*1024)) + ' Tb'; + if (value<1024) return value + ' B'; + if (value<1024*1024) return formatDecimal(value/1024) + ' KB'; + if (value<1024*1024*1024) return formatDecimal(value/(1024*1024)) + ' MB'; + if (value<1024*1024*1024*1024) return formatDecimal(value/(1024*1024*1024)) + ' GB'; + return formatDecimal(value/(1024*1024*1024*1024)) + ' TB'; } function formatSpeed(total, rate) { return formatSize(total) + ' @ ' + formatSize(rate) + '/s'