[tor-commits] [atlas/master] Switch to using KiB/MiB instead of kB/MB to match tor

irl at torproject.org irl at torproject.org
Sat Apr 22 15:23:41 UTC 2017


commit a2b3f23f0212a16ae410d513749b535fdbe6bc5a
Author: Iain R. Learmonth <irl at fsfe.org>
Date:   Sat Apr 22 16:21:53 2017 +0100

    Switch to using KiB/MiB instead of kB/MB to match tor
    
    The Tor client uses 1024 bytes per "KBytes" in the torrc, but Atlas was using
    1000. This also replaces units with the binary prefixed version.
    
    Closes: #21822
---
 js/helpers.js            | 8 ++++----
 templates/search/do.html | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/js/helpers.js b/js/helpers.js
index 0d50709..583a302 100644
--- a/js/helpers.js
+++ b/js/helpers.js
@@ -249,13 +249,13 @@ var CountryCodes = {
 }
 
 function hrBandwidth(bw) {
-    var bw_k = bw/1000;
-    var bw_m = bw_k/1000;
+    var bw_k = bw/1024;
+    var bw_m = bw_k/1024;
 
     if (bw_m >= 1) {
-        return Math.round(bw_m * 100) / 100 + " MB/s";
+        return Math.round(bw_m * 100) / 100 + " MiB/s";
     } else if (bw_k >= 1) {
-        return Math.round(bw_k * 100) / 100 + " KB/s";
+        return Math.round(bw_k * 100) / 100 + " KiB/s";
     }
 
     return bw + " B/s";
diff --git a/templates/search/do.html b/templates/search/do.html
index 51a2d82..7122ede 100644
--- a/templates/search/do.html
+++ b/templates/search/do.html
@@ -131,7 +131,7 @@
             <input type="text" id="nickname" name="nickname" placeholder="Nickname" class="search_init">
         </th>
 		<th>
-			<input type="text" id="bw_from" name="bw_from" placeholder="From (KB/s)" class="search_init span1"><input type="text" id="bw_to"name="bw_to" placeholder="To (KB/s)" class="search_init span1">
+			<input type="text" id="bw_from" name="bw_from" placeholder="From (KiB/s)" class="search_init span1"><input type="text" id="bw_to"name="bw_to" placeholder="To (KiB/s)" class="search_init span1">
 		</th>
 		<th>
 			<input type="text" id="uptime_from" name="uptime_from" placeholder="From (days)" class="search_init span1">



More information about the tor-commits mailing list