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

macosx/framework: Support printing negative duration.

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