QString KLocalePrivate::prettyFormatDuration(unsigned long mSec) const
{
unsigned long ms = mSec;
int days = ms / (24 * 3600000);
ms = ms % (24 * 3600000);
int hours = ms / 3600000;
ms = ms % 3600000;
int minutes = ms / 60000;
ms = ms % 60000;
int seconds = qRound(ms / 1000.0);
// Handle correctly problematic case #1 (look at KLocaleTest::prettyFormatDuration()
// at klocaletest.cpp)
if (seconds == 60) {
return prettyFormatDuration(mSec - ms + 60000);
}
if (days && hours) {
return i18nc("@item:intext days and hours. This uses the previous item:intext messages. If this does not fit the grammar of your language please contact the i18n team to solve the problem",
"%1 and %2", formatSingleDuration(KLocalePrivate::DaysDurationType, days),
return i18nc("@item:intext hours and minutes. This uses the previous item:intext messages. If this does not fit the grammar of your language please contact the i18n team to solve the problem",
return i18nc("@item:intext minutes and seconds. This uses the previous item:intext messages. If this does not fit the grammar of your language please contact the i18n team to solve the problem",