removed mods directory from the ATutor codebase
[atutor.git] / mods / atutor_opencaps / opencaps / conversion_service / include / classes / static_TimeUtil_class.php
diff --git a/mods/atutor_opencaps/opencaps/conversion_service/include/classes/static_TimeUtil_class.php b/mods/atutor_opencaps/opencaps/conversion_service/include/classes/static_TimeUtil_class.php
deleted file mode 100755 (executable)
index 27379b9..0000000
+++ /dev/null
@@ -1,186 +0,0 @@
-<?php\r
-class TimeUtil \r
-{\r
-       \r
-       /**\r
-        * Converts milliseconds time mark into 00:00:00:000 format (QT native format)\r
-        *\r
-        * @param int $miliSecTime A time format in miliseconds (e.g. 26070) 1000 = 1 second\r
-        * @return String $qtTimeString A QT mark in 00:00:00:000 format\r
-        */\r
-       static public function timeSamiToQt($miliSecTime)\r
-       {\r
-               $qtTimeString = '';\r
-               //  milliseconds holder \r
-               $myMiliSecTime = $miliSecTime;\r
-               \r
-               // basic constant knowledge, values in milliseconds\r
-               $anHour = 3600000; // 60*60*1000\r
-               $aMin = 60000; // 60*1000\r
-               $aSec = 1000; // 1 * 1000\r
-               \r
-               // temp holders for to store equivalent  hh, mm, sec, milisec\r
-               $myHours = 0;\r
-               $myMins = 0;\r
-               $mySec = 0;\r
-                               //$myMsec = 0; /// not using it.!!! \r
-               \r
-        // initialize timeArray\r
-               $timeArray = array();\r
-               $timeArray['hour'] = '';\r
-               $timeArray['min'] = '';\r
-               $timeArray['sec'] = '';\r
-               $timeArray['msec'] = '';                \r
-               \r
-               // parsing millisecodns QT time format 00:00:00.000\r
-\r
-               // is time mark at least an hour?\r
-               if($miliSecTime>=$anHour)\r
-               {\r
-                       // get only the int value\r
-                       $myHours = intval($miliSecTime/$anHour);\r
-\r
-                       // set the tot milliseconds left after removing number of hour(s) \r
-                       $myMiliSecTime -= ($myHours*$anHour);\r
-\r
-                       // set the current hours add leading 0 if needed\r
-                       if ($myHours<10)\r
-                       {\r
-                               $timeArray['hour'] = '0'.$myHours;\r
-                       } else {\r
-                               $timeArray['hour'] = ''.$myHours; \r
-                       }\r
-               } else {\r
-                       $timeArray['hour'] = '00';\r
-               }\r
-               \r
-               // Is time mark at least a minute? or rather, how many minutes are left?\r
-               if($myMiliSecTime>=$aMin-1)\r
-               {\r
-                       // get only the int value\r
-                       $myMins = intval($myMiliSecTime/$aMin);\r
-                                               \r
-                       // set the milliseconds left after removing total of minute(s) \r
-                       $myMiliSecTime -= ($myMins*$aMin);\r
-                       \r
-                       // set the current minutes and add leading 0 if needed\r
-                       if ($myMins<10)\r
-                       {\r
-                               $timeArray['min'] = '0'.$myMins;\r
-                       } else {\r
-                               $timeArray['min'] = ''. $myMins;\r
-                       }\r
-               } else {\r
-                       $timeArray['min'] = '00';\r
-               }\r
-               \r
-               // does it have seconds, or rather, how many seconds are left\r
-               if($myMiliSecTime>=$aSec)\r
-               {\r
-                       // get only the int value\r
-                       $mySec = intval($myMiliSecTime/$aSec);\r
-\r
-                       // set the milliseconds left after removing total of seconds\r
-                       $myMiliSecTime -= ($mySec*$aSec);\r
-                        \r
-                       // set the current number of seconds in time array, and add leading 0 if needed\r
-                       if ($mySec<10)\r
-                       {\r
-                               $timeArray['sec'] = '0'.$mySec;\r
-                       } else {\r
-                               $timeArray['sec'] = ''.$mySec;\r
-                       }\r
-               } else {\r
-                       $timeArray['sec'] = '00';\r
-               }\r
-               \r
-               // here a fix for adding leading zeros to milliseconds (e.g. 1=001, 10=010)  \r
-               if($myMiliSecTime>0)\r
-               {\r
-                       $tempMilliSec = 0 + (0.001 * $myMiliSecTime);\r
-                       $tempMilliSecArray = explode('.',$tempMilliSec); // split using '.' as separator\r
-                       $myMiliSecTimeString = ''. $tempMilliSecArray[1]; // get only the decimal value as a string\r
-\r
-                       // add one zero after the sting value if $myMiliSecTimeString has 2 character\r
-                       if (strlen($myMiliSecTimeString)==2)\r
-                       {\r
-                               $myMiliSecTimeString .= '0';\r
-                       } \r
-                       // add two zeros after the sting value if $myMiliSecTimeString has 1 character\r
-                       else if (strlen($myMiliSecTimeString)==1)\r
-                       {\r
-                               $myMiliSecTimeString .= '00';\r
-                       }\r
-                       \r
-                       // set  millisecodns  \r
-                       $timeArray['msec'] = $myMiliSecTimeString;\r
-               } else {\r
-                       $timeArray['msec'] = '000'; // no milliseconds left\r
-               } \r
-\r
-               // concatenate values\r
-               $qtTimeString = ''.$timeArray['hour'].':'.$timeArray['min'].':'.$timeArray['sec'].'.'.$timeArray['msec'];\r
-               \r
-               return $qtTimeString;\r
-               \r
-       } // end samiToQtTime()\r
-\r
-       /**\r
-        * Converts QT time to miliseconds format (Accepted by SAMI 1.0 and other CCformats)\r
-        * @return int $samiTime Time in miliseconds format; 1000 = 1. sec\r
-        * @param String $qtTime QT time Format; (e.g. "00:01:10.280")\r
-        */\r
-       static public function timeQtToSami($qtTime)\r
-       {\r
-           // Known patterns: 1, 2, or 3 decimals for millisecond definition\r
-               $pattern_time_000 = "\[([0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3})\]";\r
-       $pattern_time_00 = "\[([0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{2})\]";\r
-       $pattern_time_0 = "\[([0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{1})\]";\r
-       $pattern_selected = '';\r
-               \r
-       // If pattern is 3 digit\r
-       if(preg_match('/'.$pattern_time_000.'/',$qtTime))\r
-           {\r
-               $pattern_selected = $pattern_time_000;\r
-           }\r
-           // If pattern is 2 digit\r
-       if(preg_match('/'.$pattern_time_00.'/',$qtTime))\r
-           {\r
-               $pattern_selected = $pattern_time_00;\r
-           }\r
-           // If pattern is 1 digit\r
-       if(preg_match('/'.$pattern_time_0.'/',$qtTime))\r
-           {\r
-               $pattern_selected = $pattern_time_0;\r
-           }\r
-           \r
-           $t1 = 0; // hours (e.g. [01])\r
-           $t2 = 0; // minutes (e.g. [12])\r
-           $t3 = 0; // seconds (e.g. [01.123])\r
-           \r
-           $qtTimeParts = split(':',$qtTime); // split QT time mark into an array\r
-           \r
-           $t1 += $qtTimeParts[0]; // adding hours\r
-           $t2 += $qtTimeParts[1]; // adding minutes\r
-           $t3 += $qtTimeParts[2]; // adding seconds and miliseconds\r
-\r
-           // millisecond equivalents\r
-           $t1 *= 3600000; // 1 hour = 60*60*1000\r
-           $t2 *= 60000; // 1 minute = 60*1000\r
-           $t3 *= 1000; // 1 second = 1*1000 \r
-           \r
-           // get time in milliseconds\r
-           $samiTime = $t1 + $t2 + $t3;\r
-\r
-           return $samiTime;\r
-       \r
-       } // end timeQtToSami() \r
-\r
-       \r
-       \r
-       /********************************\r
-        * still working on more time functions \r
-        *********************************/     \r
-\r
-} // end TimeUtil\r
-?>
\ No newline at end of file