Skip to content

Commit

Permalink
Fix srt timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
mantas-done committed Jan 30, 2024
1 parent 06e006e commit 77e0f26
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Code/Converters/SrtConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public static function internalTimeToSrt($internal_time)
$negative = true;
$internal_time = abs($internal_time);
}
$internal_time = round($internal_time, 3);

$hours = floor($internal_time / 3600);
$minutes = floor(((int)$internal_time % 3600) / 60);
Expand Down
1 change: 1 addition & 0 deletions tests/formats/SrtTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ public function testConvertToSrtTime()
$this->assertEquals('00:00:00,001', SrtConverter::internalTimeToSrt(0.001));
$this->assertEquals('00:00:00,010', SrtConverter::internalTimeToSrt(0.01));
$this->assertEquals('00:00:00,100', SrtConverter::internalTimeToSrt(0.1));
$this->assertEquals('00:00:01,000', SrtConverter::internalTimeToSrt(0.9999));
$this->assertEquals('99:59:59,000', SrtConverter::internalTimeToSrt(359999));
$this->assertEquals('100:00:00,000', SrtConverter::internalTimeToSrt(360000));
}
Expand Down

0 comments on commit 77e0f26

Please sign in to comment.