<?
    /* This function is REQUIRED to display uptime stats in anything but
       a seconds value. Make sure you include it.
     */
    function duration ($time)
    {
	while ($time >= 86400)
	{
	    $days++;
	    $time -= 86400;
	}

	while ($time >= 3600)
	{
	    $hrs++;
	    $time -= 3600;
	}

	while ($time >= 60)
	{
	    $mins++;
	    $time -= 60;
	}

	if ($days)
	    $timed .= "$days day" . $ttmp = ($days > 1) ? "s" : "";

	if ($days && $hrs)
	    $timed .= ", ";
	else
	    $timed .= " ";

	if ($hrs)
	    $timed .= "$hrs hour" . $ttmp = ($hrs > 1) ? "s" : "";

	if ($hrs && $mins)
	    $timed .= ", ";
	else
	    $timed .= " ";

	if ($mins)
	    $timed .= "$mins minute" . $ttmp = ($mins > 1) ? "s" : "";

	if ($mins && $time)
	    $timed .= ", ";
	else
	    $timed .= " ";

	if ($time)
	    $timed .= "$time second" . $ttmp = ($time > 1) ? "s" : "";

	if (!$timed)
	    $timed = "0 seconds ";

	if ($ago)
	    return $timed .= "ago";
	else
	    return $timed;
 }
?>