<?php

$gmtOffset 
= -5;

if(
file_exists('/proc/uptime')) {
    
$f file('/proc/uptime');
    
$arr explode(' '$f[0]);

    echo 
'Current time: '.date("g:i a"time()+($gmtOffset*3600));
    echo 
'<br>Server Uptime: '.elapsedtime($arr[0]);
}

function 
elapsedtime($sec){
    if(
$sec<60) return $sec.' seconds';

    
$days  floor($sec 86400);
    
$hrs   floor(bcmod($sec,86400)/3600);
    
$mins  round(bcmod(bcmod($sec,86400),3600)/60);
    if(
$days 0$tstring $days.' days, ';
    if(
$hrs  0$tstring .= $hrs.' hours, ';
    
$tstring .=  $mins.' minutes';
    return 
$tstring;




?>