1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-22 12:34:27 +00:00

miner.php trim trailing zeros on some of the STATS numbers

This commit is contained in:
Kano 2013-01-18 20:33:23 +11:00
parent 9447610091
commit 383a21bebf

View File

@ -590,6 +590,14 @@ function classlastshare($when, $alldata, $warnclass, $errorclass)
return ''; return '';
} }
# #
function endzero($num)
{
$rep = preg_replace('/0*$/', '', $num);
if ($rep === '')
$rep = '0';
return $rep;
}
#
function fmt($section, $name, $value, $when, $alldata) function fmt($section, $name, $value, $when, $alldata)
{ {
global $dfmt, $rownum; global $dfmt, $rownum;
@ -869,6 +877,23 @@ function fmt($section, $name, $value, $when, $alldata)
$dec = '.'.$parts[1]; $dec = '.'.$parts[1];
$ret = number_format((float)$parts[0]).$dec; $ret = number_format((float)$parts[0]).$dec;
break; break;
case 'STATS.Hs':
case 'STATS.W':
case 'STATS.history_time':
case 'STATS.Pool Wait':
case 'STATS.Pool Max':
case 'STATS.Pool Min':
case 'STATS.Pool Av':
case 'STATS.Min Diff':
case 'STATS.Max Diff':
case 'STATS.Work Diff':
$parts = explode('.', $value, 2);
if (count($parts) == 1)
$dec = '';
else
$dec = '.'.endzero($parts[1]);
$ret = number_format((float)$parts[0]).$dec;
break;
case 'GPU.Status': case 'GPU.Status':
case 'PGA.Status': case 'PGA.Status':
case 'DEVS.Status': case 'DEVS.Status':