@@ -1,26 +1,8 @@
<?php
include("funcs.inc.php");
-function format_duration($seconds_count)
-{
- $delimiter = ':';
- $seconds = $seconds_count % 60;
- $minutes = floor($seconds_count/60) % 60;
- $hours = floor($seconds_count/3600);
-
- $seconds = str_pad($seconds, 2, "0", STR_PAD_LEFT);
- $minutes = str_pad($minutes, 2, "0", STR_PAD_LEFT).$delimiter;
-
- if($hours > 0)
- {
- $hours = str_pad($hours, 2, "0", STR_PAD_LEFT).$delimiter;
- }
- else
- {
- $hours = '';
- }
-
- return "$hours$minutes$seconds";
+function format_duration($seconds_count) {
+ return ltrim(gmdate('H:i:s', $seconds_count), '0:');
}
function format_url_args($args)
The format_duration manually compute everything when it could just use the build-in date format function and trim the beginning for the same result. Signed-off-by: Victor Huesca <victor.huesca@bootlin.com> --- web/index.php | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-)