index : website | |
Archlinux32 website - obsolete | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2018-07-27 08:27:37 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-07-27 08:27:37 +0200 |
commit | 1a7538265f7a2748e8864c002e75e55cb8a270ba (patch) | |
tree | b4f9478e9b8ce3cb2e617cda23c6a4bbcc18be39 /lib/converter.php | |
parent | b2c2b43629729f0e753466ce3c543f59842b943a (diff) |
-rw-r--r-- | lib/converter.php | 86 |
diff --git a/lib/converter.php b/lib/converter.php deleted file mode 100644 index 41951c7..0000000 --- a/lib/converter.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php - -# do not include twice -if (function_exists("format_time_duration")) - return; - -require_once "../init.php"; - -function format_time_duration($val) { - $val = floor($val); - $result = ""; - $result = - sprintf( - "%02d", - $val % 60 - ); - $val = floor($val / 60); - if ($val == 0) - return $result; - $result = - sprintf( - "%02d:%s", - $val % 60, - $result - ); - $val = floor($val / 60); - if ($val == 0) - return $result; - $result = - sprintf( - "%d:%s", - $val % 24, - $result - ); - $val = floor($val / 24); - if ($val == 0) - return $result; - $tmp = $val % 7; - $printed_conjunction = true; - if ($tmp > 1) - $result = - sprintf( - "%d days and %s", - $tmp, - $result - ); - elseif ($tmp == 1) - $result = - sprintf( - "%d day and %s", - $tmp, - $result - ); - else - $printed_conjunction = false; - $val = floor($val / 7); - if ($val == 0) - return $result; - if ($printed_conjunction) - $result = - sprintf( - ", %s", - $result - ); - else - $result = - sprintf( - " and %s", - $result - ); - if ($val>1) - $result = - sprintf( - "%d weeks%s", - $val, - $result - ); - else - $result = - sprintf( - "%d week%s", - $val, - $result - ); - return $result; -} |