Improve SecondsFormatter readability.
This commit is contained in:
parent
1e6aa2975f
commit
a3398a1f07
1 changed files with 5 additions and 5 deletions
|
@ -29,14 +29,14 @@
|
|||
return nil;
|
||||
}
|
||||
|
||||
double floatValue = [object doubleValue];
|
||||
NSTimeInterval timeInterval = [object doubleValue];
|
||||
|
||||
if (isnan(floatValue)) { return @"NaN"; }
|
||||
if (isinf(floatValue)) { return @"Inf"; }
|
||||
if (isnan(timeInterval)) { return @"NaN"; }
|
||||
if (isinf(timeInterval)) { return @"Inf"; }
|
||||
|
||||
BOOL isNegative = signbit(floatValue);
|
||||
BOOL isNegative = signbit(timeInterval);
|
||||
|
||||
int totalSeconds = (int)(isNegative ? -floatValue : floatValue);
|
||||
int totalSeconds = (int)(isNegative ? -timeInterval : timeInterval);
|
||||
|
||||
int seconds = totalSeconds % 60;
|
||||
int minutes = totalSeconds / 60;
|
||||
|
|
Loading…
Reference in a new issue