VLCKit: don't return timestamps with hour digits, if time is shorter than 1 hour
[vlc.git] / projects / macosx / framework / Sources / VLCTime.m
index 360a01d..d145cd6 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 @"--:--";
     }
 }