add elapsed time function
parent
e3f4aaa367
commit
348944d59e
|
@ -91,6 +91,27 @@ if (isset($_GET['do'])) {
|
||||||
<th><img src="./images/ear.png" alt="Listening on" /></th>
|
<th><img src="./images/ear.png" alt="Listening on" /></th>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
|
function elapsedTime ($time){
|
||||||
|
|
||||||
|
$time = time() - $time; // to get the time since that moment
|
||||||
|
$time = ($time<1)? 1 : $time;
|
||||||
|
$tokens = array (
|
||||||
|
31536000 => 'year',
|
||||||
|
2592000 => 'month',
|
||||||
|
604800 => 'week',
|
||||||
|
86400 => 'day',
|
||||||
|
3600 => 'hour',
|
||||||
|
60 => 'minute',
|
||||||
|
1 => 'second'
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($tokens as $unit => $text) {
|
||||||
|
if ($time < $unit) continue;
|
||||||
|
$numberOfUnits = floor($time / $unit);
|
||||||
|
return $numberOfUnits.' '.$text.(($numberOfUnits>1)?'s':'');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
$Reflector->LoadFlags();
|
$Reflector->LoadFlags();
|
||||||
for ($i=0;$i<$Reflector->StationCount();$i++) {
|
for ($i=0;$i<$Reflector->StationCount();$i++) {
|
||||||
$ShowThisStation = true;
|
$ShowThisStation = true;
|
||||||
|
|
Loading…
Reference in New Issue