Location: PHPKode > projects > DebWeb GUI > debwgui/functions/uptime.php
<?php
// function to calculate uptime (copyrighted to phpsysinfo.sf.net)
function calcuptime() {
global $CMD_CAT;
  $uptime = '';
  $buf = exec("$CMD_CAT /proc/uptime");
  $ar_buf = split( ' ', $buf );
  $timestamp = trim( $ar_buf[0] );

  $min = $timestamp / 60;
  $hours = $min / 60;
  $days = floor($hours / 24);
  $hours = floor($hours - ($days * 24));
  $min = floor($min - ($days * 60 * 24) - ($hours * 60));

  if ($days != 0) {
    $uptime .= $days. "&nbsp;days&nbsp;";
  }

  if ($hours != 0) {
    $uptime .= $hours . "&nbsp;hours&nbsp;";
  }

  $uptime .= $min . "&nbsp;minutes";
  return $uptime;
}
?>
Return current item: DebWeb GUI