Advertisement
ivandrofly

Subtitle Edit: calculating remaining time

Dec 20th, 2017
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.53 KB | None | 0 0
  1. // variante #1
  2. double surplusChars = charPerSecond % maxCharPerSecond;
  3. double optimalMissingTime = surplusChars / maxCharPerSecond * TimeCode.BaseUnit;
  4. temp.EndTime.TotalMilliseconds += optimalMissingTime;
  5.  
  6. // variante #2
  7. double msPerChar = 1 / maxCharPerSecond * TimeCode.BaseUnit;
  8. temp.EndTime.TotalMilliseconds += surplusChars * msPerChar;
  9.  
  10. // variante #3
  11. temp.EndTime.TotalMilliseconds = temp.Text.Length / maxCharPerSecond * TimeCode.BaseUnit;
  12.  
  13. see: https://github.com/SubtitleEdit/subtitleedit/pull/1694/files (not correct!)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement