- QStringList returnString;
- for (int i = 0; i < timeUnit.size(); i++) {
- int n = timeInSeconds / timeUnit[i].first;
- if (n > 0) {
- returnString += QString("%1 %2").arg(QString::number(n), timeUnit[i].second);
+ if (timeInSeconds != 0) {
+ QStringList returnString;
+ for (int i = 0; i < timeUnit.size(); i++) {
+ int n = timeInSeconds / timeUnit[i].first;
+ if (n > 0) {
+ returnString += QString("%1 %2").arg(QString::number(n), timeUnit[i].second);
+ }
+ timeInSeconds = timeInSeconds % timeUnit[i].first;