nice
All checks were successful
Build and push / Pulling repo on server (push) Successful in 2s
All checks were successful
Build and push / Pulling repo on server (push) Successful in 2s
This commit is contained in:
@ -322,4 +322,34 @@ function template($templatefile,$variables=[])
|
||||
ob_end_clean();
|
||||
|
||||
return $pagecontent;
|
||||
}
|
||||
}
|
||||
|
||||
function printRelativeTime($timestamp1, $timestamp2)
|
||||
{
|
||||
$diff = abs($timestamp2 - $timestamp1);
|
||||
|
||||
$intervals = array(
|
||||
'year' => 31536000,
|
||||
'month' => 2592000,
|
||||
'week' => 604800,
|
||||
'day' => 86400,
|
||||
'hour' => 3600,
|
||||
'minute' => 60,
|
||||
'second' => 1
|
||||
);
|
||||
|
||||
$output = '';
|
||||
|
||||
foreach ($intervals as $interval => $seconds) {
|
||||
$count = floor($diff / $seconds);
|
||||
|
||||
if ($count > 0) {
|
||||
$output .= $count . ' ' . ($count === 1 ? $interval : $interval . 's') . ', ';
|
||||
$diff -= $count * $seconds;
|
||||
}
|
||||
}
|
||||
|
||||
$output = rtrim($output, ', ');
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
Reference in New Issue
Block a user