Added 'days' to playlist total time, but only if the total hours is 24 or greater
parent
17b6af6417
commit
1b4ef20d19
|
@ -150,16 +150,23 @@
|
||||||
{
|
{
|
||||||
double tt = 0;
|
double tt = 0;
|
||||||
ldiv_t hoursAndMinutes;
|
ldiv_t hoursAndMinutes;
|
||||||
|
ldiv_t daysAndHours;
|
||||||
|
|
||||||
for (PlaylistEntry *pe in [self arrangedObjects]) {
|
for (PlaylistEntry *pe in [self arrangedObjects]) {
|
||||||
if (!isnan([pe.length doubleValue]))
|
if (!isnan([pe.length doubleValue]))
|
||||||
tt += [pe.length doubleValue];
|
tt += [pe.length doubleValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
int sec = (int)(tt);
|
long sec = (long)(tt);
|
||||||
hoursAndMinutes = ldiv(sec/60, 60);
|
hoursAndMinutes = ldiv(sec/60, 60);
|
||||||
|
|
||||||
[self setTotalTime:[NSString stringWithFormat:@"%ld hours %ld minutes %d seconds", hoursAndMinutes.quot, hoursAndMinutes.rem, sec%60]];
|
if ( hoursAndMinutes.quot >= 24 )
|
||||||
|
{
|
||||||
|
daysAndHours = ldiv(hoursAndMinutes.quot, 24);
|
||||||
|
[self setTotalTime:[NSString stringWithFormat:@"%ld days %ld hours %ld minutes %ld seconds", daysAndHours.quot, daysAndHours.rem, hoursAndMinutes.rem, sec%60]];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
[self setTotalTime:[NSString stringWithFormat:@"%ld hours %ld minutes %ld seconds", hoursAndMinutes.quot, hoursAndMinutes.rem, sec%60]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)tableView:(NSTableView *)tableView
|
- (void)tableView:(NSTableView *)tableView
|
||||||
|
|
Loading…
Reference in New Issue