in reply to Time shift for SRT subtitles

Hi, thanks for your idea for subtitle shifting. Unfortunately your code has a bug for negative time shifts. Here is alternative code that avoids the bug alltogether by first calculating the new time (in ms) and working out the other time values from there.
s{ (\d+) : (\d\d) : (\d\d) , (\d+) } { $time = $1 * 3600E3 + $2 * 60E3 + ($3 + $dt) * 1E3 + $4; $h = int $time / 3600E3; $time %= 3600E3; $m = int $time / 60E3; $time %= 60E3; $s = int $time / 1E3; $time %= 1E3; $ms = int $time; sprintf "%02d:%02d:%02d,%03d", $h, $m, $s, $ms; }gxe;