]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/bacula-web/bweb.inc.php
bacula-web: New function Get_ElapsedTime in bweb.inc.php
[bacula/bacula] / gui / bacula-web / bweb.inc.php
index 2d584c30ce0738cc7f801a968c99747b920ee174..51f46aed0f66e60344a47b80637634a48d46f4b3 100644 (file)
@@ -428,6 +428,27 @@ class Bweb extends DB {
                        }
                }
                
+               // Return elasped time string for a job
+               function Get_ElapsedTime( $start_time, $end_time ) 
+               { 
+                       $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;
+               }
+               
                public function Get_ElapsedTime_Job( $delay = LAST_DAY )
                {
                        $query                  = "";
@@ -457,7 +478,7 @@ class Bweb extends DB {
                                        $total_elapsed += $time['elapsed'];
                                }
                                // Verify if elapsed time is more than 1 day
-                               if ( $total_elapsed > 86400 ) {
+                               if ( $total_elapsed > LAST_DAY ) {
                                        return date("%d days H:i:s", $total_elapsed );
                                }else {
                                        return date("H:i:s", $total_elapsed );
@@ -492,9 +513,9 @@ class Bweb extends DB {
                                        $where = "AND JobStatus = 'T' ";
                                        $label = "Completed";
                                break;
-                               case 'completed_errors':
-                                       $where = "AND JobStatus = 'E' ";
-                                       $label = "Completed with errors";
+                               case 'terminated_errors':
+                                       $where = $interval_where . "JobStatus = 'E' ";
+                                       $label = "Terminated with errors";
                                break;
                                case 'failed':
                                        $where = "AND JobStatus = 'f' ";