Commit a99d9803 authored by Marvin Scholz's avatar Marvin Scholz

macosx: Use NSDateComponentsFormatter for playlist duration

This should fix a bug with off-by-one days calculation.

Fix #19221
parent 39007831
......@@ -882,16 +882,12 @@ static const float f_min_window_height = 307.;
mt_duration = mt_duration / 1000000;
NSDate *date = [NSDate dateWithTimeIntervalSince1970:mt_duration];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
if (mt_duration >= 86400) {
[formatter setDateFormat:@"dd:HH:mm:ss"];
} else {
[formatter setDateFormat:@"HH:mm:ss"];
}
[formatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
NSDateComponentsFormatter *formatter = [[NSDateComponentsFormatter alloc] init];
formatter.unitsStyle = NSDateComponentsFormatterUnitsStyleAbbreviated;
NSString* outputString = [formatter stringFromTimeInterval:mt_duration];
return [NSString stringWithFormat:@" — %@",[formatter stringFromDate:date]];
return [NSString stringWithFormat:@" — %@", outputString];
}
- (IBAction)searchItem:(id)sender
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment