]> git.sur5r.net Git - bacula/bacula/commitdiff
bacula-web: Split TimeUtils php class into new file timeutils.class.php
authorDavide Franco <bacula-dev@dflc.ch>
Wed, 22 Jun 2011 15:43:33 +0000 (17:43 +0200)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:49:14 +0000 (14:49 +0200)
gui/bacula-web/config.inc.php
gui/bacula-web/includes/utils/timeutils.class.php [new file with mode: 0644]
gui/bacula-web/includes/utils/utils.class.php

index 236533f909418887a02dcd9eac6b2ee5cd5c1afe..2dcc796fb6119f280e761106d1eda127d4b18041 100644 (file)
@@ -33,6 +33,7 @@
  require_once BW_OBJ . "graph/bgraph.class.php";
  require_once BW_OBJ . "bweb.inc.php";
  require_once BW_OBJ . "utils/utils.class.php";
+ require_once BW_OBJ . "utils/timeutils.class.php";
  
  // Global constants
  define('CONFIG_DIR', BW_ROOT . "/config/");
diff --git a/gui/bacula-web/includes/utils/timeutils.class.php b/gui/bacula-web/includes/utils/timeutils.class.php
new file mode 100644 (file)
index 0000000..cd3b13a
--- /dev/null
@@ -0,0 +1,53 @@
+<?php
+/* 
++-------------------------------------------------------------------------+
+| Copyright 2010-2011, Davide Franco                                             |
+|                                                                         |
+| This program is free software; you can redistribute it and/or           |
+| modify it under the terms of the GNU General Public License             |
+| as published by the Free Software Foundation; either version 2          |
+| of the License, or (at your option) any later version.                  |
+|                                                                         |
+| This program is distributed in the hope that it will be useful,         |
+| but WITHOUT ANY WARRANTY; without even the implied warranty of          |
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           |
+| GNU General Public License for more details.                            |
++-------------------------------------------------------------------------+ 
+*/
+
+class TimeUtils {
+       static public function Get_Elapsed_Time( $start_time, $end_time)
+       {
+               $start = '';
+               $end   = '';
+               
+               if( $start_time == '0000-00-00 00:00:00' )
+                       return 'N/A';
+               else
+                       $start = strtotime( $start_time );                                      
+        
+               if( $end_time == '0000-00-00 00:00:00' )
+                       $end = mktime();
+               else
+                       $end   = strtotime( $end_time );
+               
+               $diff = $end - $start;
+
+        $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;
+       }
+}
+
+?>
index e2f02209da25b5591abe70aa141662f7f7af6f18..b9eddfb3155094e46f6878015ce273a93f08c337 100644 (file)
@@ -47,39 +47,4 @@ class Utils {
        }
 }
 
-class TimeUtils {
-       static public function Get_Elapsed_Time( $start_time, $end_time)
-       {
-               $start = '';
-               $end   = '';
-               
-               if( $start_time == '0000-00-00 00:00:00' )
-                       return 'N/A';
-               else
-                       $start = strtotime( $start_time );                                      
-        
-               if( $end_time == '0000-00-00 00:00:00' )
-                       $end = mktime();
-               else
-                       $end   = strtotime( $end_time );
-               
-               $diff = $end - $start;
-
-        $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;
-       }
-}
-
 ?>