]> git.sesse.net Git - vlc/commitdiff
VLCKit: don't return timestamps with hour digits, if time is shorter than 1 hour
authorFelix Paul Kühne <fkuehne@videolan.org>
Wed, 19 Aug 2009 20:23:42 +0000 (22:23 +0200)
committerFelix Paul Kühne <fkuehne@videolan.org>
Wed, 19 Aug 2009 20:24:26 +0000 (22:24 +0200)
projects/macosx/framework/Sources/VLCTime.m

index 360a01dda39ab2ebed2ed4b4cdab6beeff1ff792..d145cd6204b9b9412d1008e14141baa6cc0b2977 100644 (file)
     if (value)
     {
         long long duration = [value longLongValue] / 1000000;
-        return [NSString stringWithFormat:@"%01d:%02d:%02d",
-            (long) (duration / 3600),
-            (long)((duration / 60) % 60),
-            (long) (duration % 60)];
+        if( duration > 3600 )
+            return [NSString stringWithFormat:@"%01d:%02d:%02d",
+                (long) (duration / 3600),
+                (long)((duration / 60) % 60),
+                (long) (duration % 60)];
+        else
+            return [NSString stringWithFormat:@"%02d:%02d",
+                    (long)((duration / 60) % 60),
+                    (long) (duration % 60)];
     }
     else
     {
         // Return a string that represents an undefined time.
-        return @"-:--:--";
+        return @"--:--";
     }
 }