add elapsed time function

elapsedtime
kc1awv 2020-10-24 14:47:11 -04:00
parent e3f4aaa367
commit 348944d59e
1 changed files with 21 additions and 0 deletions

View File

@ -91,6 +91,27 @@ if (isset($_GET['do'])) {
<th><img src="./images/ear.png" alt="Listening on" /></th>
</tr>
<?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();
for ($i=0;$i<$Reflector->StationCount();$i++) {
$ShowThisStation = true;