Browse Source

php - display some real stats in the header

master
kanoi 11 years ago
parent
commit
d67d96abdd
  1. 34
      pool/page.php

34
pool/page.php

@ -123,10 +123,10 @@ function pgtop($dotop, $user, $douser)
global $site_title; global $site_title;
$info = homeInfo($user); $info = homeInfo($user);
$phr = ' '; $phr = '?THs';
$plb = ' '; $plb = '?';
$nlb = ' '; $nlb = '?';
$uhr = ' '; $uhr = '?GHs';
if ($info !== false) if ($info !== false)
{ {
$now = time(); $now = time();
@ -135,9 +135,15 @@ function pgtop($dotop, $user, $douser)
{ {
$phr = $info['p_hashrate5m']; $phr = $info['p_hashrate5m'];
if ($phr == '?') if ($phr == '?')
$phr .= 'THs'; $phr = '?THs';
else else
$phr = (round($phr/10)/100).'THs'; {
$phr /= 10000000;
if ($phr < 100000)
$phr = (round($phr)/100).'GHs';
else
$phr = (round($phr/1000)/100).'THs';
}
} }
if (isset($info['lastblock'])) if (isset($info['lastblock']))
@ -174,7 +180,10 @@ function pgtop($dotop, $user, $douser)
{ {
$sec = $now - $info['lastlp']; $sec = $now - $info['lastlp'];
$min = round($sec / 60); $min = round($sec / 60);
$nlb = $min.'m'; $nlb = '~'.$min.'m';
# $s = $sec % 60;
# if ($s > 0)
# $nlb .= " ${s}s";
} }
} }
@ -182,15 +191,14 @@ function pgtop($dotop, $user, $douser)
{ {
$uhr = $info['u_hashrate5m']; $uhr = $info['u_hashrate5m'];
if ($uhr == '?') if ($uhr == '?')
{ $uhr = '?GHs';
$uhr .= 'GHs';
}
else else
{ {
if ($uhr < 1000) $uhr /= 10000000;
$uhr .= 'GHs'; if ($uhr < 100000)
$uhr = (round($uhr)/100).'GHs';
else else
$uhr = (round($uhr/10)/100).'THs'; $uhr = (round($uhr/1000)/100).'THs';
} }
} }
} }

Loading…
Cancel
Save