Add a bit of sanity checking to FractionalTime.

Originally committed to SVN as r2936.
This commit is contained in:
Karl Blomster 2009-05-15 12:18:33 +00:00
parent 1520e51dd0
commit a3cd374bc0
1 changed files with 6 additions and 0 deletions

View File

@ -393,6 +393,11 @@ wxString FractionalTime::FromAssTime(AssTime time) {
// Milliseconds to SMPTE text string conversion
wxString FractionalTime::FromMillisecs(int64_t msec) {
int h=0, m=0, s=0, f=0; // hours, minutes, seconds, fractions
// return 00:00:00:00
if (msec <= 0)
goto RETURN;
int fn = (msec*(int64_t)num) / (1000*den); // frame number
// dropframe?
@ -435,5 +440,6 @@ wxString FractionalTime::FromMillisecs(int64_t msec) {
f = fn;
}
RETURN:
return wxString::Format(_T("%02i") + sep + _T("%02i") + sep + _T("%02i") + sep + _T("%02i"),h,m,s,f);
}