From d026f734392a2fa95e286e66c46c108bd0b6076a Mon Sep 17 00:00:00 2001 From: kkalev Date: Tue, 19 Apr 2005 13:27:30 +0000 Subject: [PATCH] In time2strclock also show days if applicable --- Changelog | 1 + lib/functions.php3 | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Changelog b/Changelog index fff13e6..41fab0b 100644 --- a/Changelog +++ b/Changelog @@ -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 diff --git a/lib/functions.php3 b/lib/functions.php3 index 8a630ee..f3bda86 100644 --- a/lib/functions.php3 +++ b/lib/functions.php3 @@ -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; } -- 2.39.5