miner.php trim trailing zeros on some of the STATS numbers
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
diff --git a/miner.php b/miner.php
index 717e26a..396121b 100644
--- a/miner.php
+++ b/miner.php
@@ -590,6 +590,14 @@ function classlastshare($when, $alldata, $warnclass, $errorclass)
return '';
}
#
+function endzero($num)
+{
+ $rep = preg_replace('/0*$/', '', $num);
+ if ($rep === '')
+ $rep = '0';
+ return $rep;
+}
+#
function fmt($section, $name, $value, $when, $alldata)
{
global $dfmt, $rownum;
@@ -869,6 +877,23 @@ function fmt($section, $name, $value, $when, $alldata)
$dec = '.'.$parts[1];
$ret = number_format((float)$parts[0]).$dec;
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 'PGA.Status':
case 'DEVS.Status':