In time2strclock also show days if applicable
authorkkalev <kkalev>
Tue, 19 Apr 2005 13:27:30 +0000 (13:27 +0000)
committerkkalev <kkalev>
Tue, 19 Apr 2005 13:27:30 +0000 (13:27 +0000)
dialup_admin/Changelog
dialup_admin/lib/functions.php3

index fff13e6..41fab0b 100644 (file)
@@ -8,6 +8,7 @@ Ver 1.80:
   Peter Nixon
 * Count online users correctly (through a separate query) in user_finger.
 * Use the correct max results variable in lib/*/find.php3
+* In time2strclock also show days if applicable
 Ver 1.78:
 * Add a snmp_clearsession which can disconnect a user by using the Cisco AAA Session MIB
 * Add a configuration directive general_sessionclear_bin
index 8a630ee..f3bda86 100644 (file)
@@ -35,7 +35,16 @@ function time2strclock($time)
        if (!$time)
                return "00:00:00";
 
-       $str["hour"] = $str["min"] = $str["sec"] = "00";
+       $str["days"] = $str["hour"] = $str["min"] = $str["sec"] = "00";
+
+       $d = $time/86400;
+       $d = floor($d);
+       if ($d){
+               if ($d < 10)
+                       $d = "0" . $d;
+               $str["days"] = "$d";
+               $time = $time % 86400;
+       }
        $h = $time/3600;
        $h = floor($h);
        if ($h){
@@ -59,7 +68,10 @@ function time2strclock($time)
        else
                $time = "00";
        $str["sec"] = "$time";
-       $ret = "$str[hour]:$str[min]:$str[sec]";
+       if ($str["days"] != "00")
+               $ret = "$str[days]:$str[hour]:$str[min]:$str[sec]";
+       else
+               $ret = "$str[hour]:$str[min]:$str[sec]";
 
        return $ret;
 }