Make AssTime::GetASSFormated roughly an order of magnitude faster
Originally committed to SVN as r6392.
This commit is contained in:
parent
0c972886fb
commit
1af19fb42e
1 changed files with 16 additions and 5 deletions
|
@ -75,11 +75,22 @@ void AssTime::ParseASS(wxString const& text) {
|
||||||
*this = AssTime(ms);
|
*this = AssTime(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString AssTime::GetASSFormated (bool msPrecision) const {
|
wxString AssTime::GetASSFormated(bool msPrecision) const {
|
||||||
if (msPrecision)
|
wxChar ret[] = {
|
||||||
return wxString::Format("%d:%02d:%02d.%03d", GetTimeHours(), GetTimeMinutes(), GetTimeSeconds(), GetTimeMiliseconds());
|
'0' + GetTimeHours(),
|
||||||
else
|
':',
|
||||||
return wxString::Format("%d:%02d:%02d.%02d", GetTimeHours(), GetTimeMinutes(), GetTimeSeconds(), GetTimeCentiseconds());
|
'0' + (time % (60 * 60 * 1000)) / (60 * 1000 * 10),
|
||||||
|
'0' + (time % (10 * 60 * 1000)) / (60 * 1000),
|
||||||
|
':',
|
||||||
|
'0' + (time % (60 * 1000)) / (1000 * 10),
|
||||||
|
'0' + (time % (10 * 1000)) / 1000,
|
||||||
|
'.',
|
||||||
|
'0' + (time % 1000) / 100,
|
||||||
|
'0' + (time % 100) / 10,
|
||||||
|
'0' + time % 10
|
||||||
|
};
|
||||||
|
|
||||||
|
return wxString(ret, msPrecision ? 11 : 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
int AssTime::GetTimeHours() const { return time / 3600000; }
|
int AssTime::GetTimeHours() const { return time / 3600000; }
|
||||||
|
|
Loading…
Reference in a new issue