From 250dc17c9a75631701c349441c9bc21dec3ea16f Mon Sep 17 00:00:00 2001 From: Davide Franco Date: Mon, 20 Jun 2011 19:00:51 +0200 Subject: [PATCH] bacula-web: New class TimeUtils in utils.class.php module - A class member function has been created --- gui/bacula-web/includes/utils/utils.class.php | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/gui/bacula-web/includes/utils/utils.class.php b/gui/bacula-web/includes/utils/utils.class.php index f4ca1776da..203dfdb578 100644 --- a/gui/bacula-web/includes/utils/utils.class.php +++ b/gui/bacula-web/includes/utils/utils.class.php @@ -46,4 +46,27 @@ class Utils { return $hsize; } } + +class TimeUtils { + static public function Get_Elapsed_Time( $start, $end) + { + $diff = $end_time - $start_time; + + $daysDiff = sprintf("%02d", floor($diff/60/60/24) ); + $diff -= $daysDiff*60*60*24; + + $hrsDiff = sprintf("%02d", floor($diff/60/60) ); + $diff -= $hrsDiff*60*60; + + $minsDiff = sprintf("%02d", floor($diff/60) ); + $diff -= $minsDiff*60; + $secsDiff = sprintf("%02d", $diff ); + + if( $daysDiff > 0 ) + return $daysDiff . 'day(s) ' . $hrsDiff.':' . $minsDiff . ':' . $secsDiff; + else + return $hrsDiff . ':' . $minsDiff . ':' . $secsDiff; + } +} + ?> -- 2.39.5