macosx: fix time format overflow if playlist duration is > 24h
authorFelix Paul Kühne <fkuehne@videolan.org>
Tue, 21 Jun 2016 13:44:24 +0000 (15:44 +0200)
committerFelix Paul Kühne <fkuehne@videolan.org>
Tue, 21 Jun 2016 13:44:30 +0000 (15:44 +0200)
modules/gui/macosx/MainWindow.m

index 4043b39..db8c971 100644 (file)
@@ -977,7 +977,11 @@ static const float f_min_window_height = 307.;
 
     NSDate *date = [NSDate dateWithTimeIntervalSince1970:mt_duration];
     NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
 
     NSDate *date = [NSDate dateWithTimeIntervalSince1970:mt_duration];
     NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
-    [formatter setDateFormat:@"HH:mm:ss"];
+    if (mt_duration >= 86400) {
+        [formatter setDateFormat:@"dd:HH:mm:ss"];
+    } else {
+        [formatter setDateFormat:@"HH:mm:ss"];
+    }
     [formatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
 
     return [NSString stringWithFormat:@" — %@",[formatter stringFromDate:date]];
     [formatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
 
     return [NSString stringWithFormat:@" — %@",[formatter stringFromDate:date]];