cvs: php-gcov-web /www site.api.php
| From: | Nuno Lopes | Date: | Thu, 19 Jul 2007 18:04:02 +0000 |
| Subject: | cvs: php-gcov-web /www site.api.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-36024@lists.php.net to get a copy of this message | ||
nlopess Thu Jul 19 18:04:02 2007 UTC
Modified files:
/php-gcov-web/www site.api.php
Log:
add support for days, and add the extra 's' only when it's > 1 :P
http://cvs.php.net/viewvc.cgi/php-gcov-web/www/site.api.php?r1=1.10&r2=1.11&diff_format=u
Index: php-gcov-web/www/site.api.php
diff -u php-gcov-web/www/site.api.php:1.10 php-gcov-web/www/site.api.php:1.11
--- php-gcov-web/www/site.api.php:1.10 Sun May 27 14:58:37 2007
+++ php-gcov-web/www/site.api.php Thu Jul 19 18:04:01 2007
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: site.api.php,v 1.10 2007/05/27 14:58:37 nlopess Exp $ */
+/* $Id: site.api.php,v 1.11 2007/07/19 18:04:01 nlopess Exp $ */
// File: Core Site API File
// Desc: contains core display functions, it is essential for all pages to include this file.
@@ -65,13 +65,19 @@
}
if ($time < 60) {
- return "$time seconds";
- }
- elseif ($time < 3600) {
- return intval($time/60) . ' minutes';
+ $unit = 'second';
+ } elseif ($time < 3600) {
+ $time = intval($time/60);
+ $unit = 'minute';
+ } elseif ($time < 172800) { // 2 days
+ $time = intval($time/3600);
+ $unit = 'hour';
} else {
- return intval($time/3600) . ' hours';
+ $time = intval($time/86400);
+ $unit = 'day';
}
+
+ return "$time $unit" . ($time > 1 ? 's' : '');
}