Skip to content

Commit

Permalink
Merge pull request #69 from Andrius521/master
Browse files Browse the repository at this point in the history
TxtConverter - cast time part to float before doing any arithmetic wi…
  • Loading branch information
mantas-done authored Jul 13, 2023
2 parents f76d260 + 0631757 commit 118457c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Code/Converters/TxtConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,16 @@ public static function timeToInternal($time)
$total_parts = count($time_parts);

if ($total_parts === 1) {
$tmp = str_replace(',', '.', $time_parts[0]);
$tmp = (float) str_replace(',', '.', $time_parts[0]);
return $tmp;
} elseif ($total_parts === 2) { // minutes:seconds format
list($minutes, $seconds) = array_map('intval', $time_parts);
$tmp = str_replace(',', '.', $time_parts[1]);
$tmp = (float) str_replace(',', '.', $time_parts[1]);
$milliseconds = $tmp - floor($tmp);
return ($minutes * 60) + $seconds + $milliseconds;
} elseif ($total_parts === 3) { // hours:minutes:seconds,milliseconds format
list($hours, $minutes, $seconds) = array_map('intval', $time_parts);
$tmp = str_replace(',', '.', $time_parts[2]);
$tmp = (float) str_replace(',', '.', $time_parts[2]);
$milliseconds = $tmp - floor($tmp);
return ($hours * 3600) + ($minutes * 60) + $seconds + $milliseconds;
} elseif ($total_parts === 4) { // hours:minutes:seconds:frames format
Expand Down

0 comments on commit 118457c

Please sign in to comment.