Commit c1d239c0 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

macosx/framework: Support printing negative duration.

parent ac8236da
...@@ -80,15 +80,18 @@ ...@@ -80,15 +80,18 @@
if (value) if (value)
{ {
long long duration = [value longLongValue] / 1000000; long long duration = [value longLongValue] / 1000000;
if( duration > 3600 ) long long positiveDuration = llabs(duration);
return [NSString stringWithFormat:@"%01d:%02d:%02d", if( positiveDuration > 3600 )
(long) (duration / 3600), return [NSString stringWithFormat:@"%s%01d:%02d:%02d",
(long)((duration / 60) % 60), duration < 0 ? "-" : ""
(long) (duration % 60)]; (long) (positiveDuration / 3600),
(long)((positiveDuration / 60) % 60),
(long) (positiveDuration % 60)];
else else
return [NSString stringWithFormat:@"%02d:%02d", return [NSString stringWithFormat:@"%s%02d:%02d",
(long)((duration / 60) % 60), duration < 0 ? "-" : ""
(long) (duration % 60)]; (long)((positiveDuration / 60) % 60),
(long) (positiveDuration % 60)];
} }
else else
{ {
......
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