show hashrates

This commit is contained in:
stoffu
2018-11-13 09:37:58 +09:00
parent 6e6a138057
commit bcb469a0a3
5 changed files with 38 additions and 5 deletions
+10
View File
@@ -9,6 +9,16 @@ function formatBytes(bytes, decimal) {
return "<b>" + parseFloat((bytes / Math.pow(c, f)).toFixed(d)) + "</b> " + e[f]
}
function formatHashrate(hr, decimal) {
if (0 == hr)
return "0 H/s";
var c = 1000;
var d = decimal || 2;
var e = ["H/s", "kH/s", "MH/s", "GH/s", "TH/s", "PH/s", "EH/s", "ZH/s", "YH/s"];
var f = Math.floor(Math.log(hr) / Math.log(c));
return "<b>" + parseFloat((hr / Math.pow(c, f)).toFixed(d)) + "</b> " + e[f]
}
function print_money(amount, decimal_point) {
var s1 = String(amount);
while (s1.length < decimal_point+1)