From d67d96abdd230df9967916f9a8c049fc8c8ead38 Mon Sep 17 00:00:00 2001 From: kanoi Date: Thu, 19 Jun 2014 00:14:39 +1000 Subject: [PATCH] php - display some real stats in the header --- pool/page.php | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/pool/page.php b/pool/page.php index cf2eb428..954a1132 100644 --- a/pool/page.php +++ b/pool/page.php @@ -123,10 +123,10 @@ function pgtop($dotop, $user, $douser) global $site_title; $info = homeInfo($user); - $phr = ' '; - $plb = ' '; - $nlb = ' '; - $uhr = ' '; + $phr = '?THs'; + $plb = '?'; + $nlb = '?'; + $uhr = '?GHs'; if ($info !== false) { $now = time(); @@ -135,9 +135,15 @@ function pgtop($dotop, $user, $douser) { $phr = $info['p_hashrate5m']; if ($phr == '?') - $phr .= 'THs'; + $phr = '?THs'; 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'])) @@ -174,7 +180,10 @@ function pgtop($dotop, $user, $douser) { $sec = $now - $info['lastlp']; $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']; if ($uhr == '?') - { - $uhr .= 'GHs'; - } + $uhr = '?GHs'; else { - if ($uhr < 1000) - $uhr .= 'GHs'; + $uhr /= 10000000; + if ($uhr < 100000) + $uhr = (round($uhr)/100).'GHs'; else - $uhr = (round($uhr/10)/100).'THs'; + $uhr = (round($uhr/1000)/100).'THs'; } } }