[vlc-devel] commit: VLCKit: don't return timestamps with hour digits, if time is shorter than 1 hour ( Felix Paul Kühne )

git version control git at videolan.org
Wed Aug 19 22:24:27 CEST 2009


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Wed Aug 19 22:23:42 2009 +0200| [bade53fbca0b1a2bfae986076ba6f1d1563f858f] | committer: Felix Paul Kühne 

VLCKit: don't return timestamps with hour digits, if time is shorter than 1 hour

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bade53fbca0b1a2bfae986076ba6f1d1563f858f
---

 projects/macosx/framework/Sources/VLCTime.m |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/projects/macosx/framework/Sources/VLCTime.m b/projects/macosx/framework/Sources/VLCTime.m
index 360a01d..d145cd6 100644
--- a/projects/macosx/framework/Sources/VLCTime.m
+++ b/projects/macosx/framework/Sources/VLCTime.m
@@ -75,15 +75,20 @@
     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 @"--:--";
     }
 }
 




More information about the vlc-devel mailing list