All pastes #574083 Raw Edit

uptime

public php v1 · immutable
·published 2007-06-18 13:05 UTC
rendered paste body
<?function uptime (){    $fd = fopen('/proc/uptime', 'r');    $ar_buf = split(' ', fgets($fd, 4096));    fclose($fd);    $sys_ticks = trim($ar_buf[0]);    $min = $sys_ticks / 60;    $hours = $min / 60;    $days = floor($hours / 24);    $hours = floor($hours - ($days * 24));    $min = floor($min - ($days * 60 * 24) - ($hours * 60));    if ($days != 0)    {      $result = "$days dagar ";    }    if ($hours != 0)    {      $result .= "$hours timmar ";    }    $result .= "$min minuter ";   return $result;}echo uptime(); ?>