OSDN Git Service

泊地修理カウンターを0分が過ぎたらマイナスで表示し続けるようにした
authormasakih <masakih@users.sourceforge.jp>
Wed, 22 Jul 2015 13:13:31 +0000 (22:13 +0900)
committermasakih <masakih@users.sourceforge.jp>
Wed, 22 Jul 2015 13:13:31 +0000 (22:13 +0900)
KCD/HMFleetViewController.m
KCD/HMTimerCountFormatter.m

index b341f2f..655a215 100644 (file)
@@ -446,10 +446,7 @@ const NSInteger maxFleetNumber = 4;
        NSTimeInterval compTime = [compTimeValue timeIntervalSince1970];
        NSDate *now = [NSDate dateWithTimeIntervalSinceNow:0];
        NSTimeInterval diff = compTime - [now timeIntervalSince1970];
-       
-       NSTimeInterval repairTime = diff + 20 * 60;
-       repairTime = repairTime > 0 ? repairTime : 0;
-       return @(repairTime);
+       return @(diff + 20 * 60);
 }
 
 @end
index 31ba4d6..5e483bf 100644 (file)
@@ -20,6 +20,9 @@
                NSLog(@"obj class is %@", NSStringFromClass([obj class]));
                return @"";
        }
+       
+       BOOL minus = timeInterval < 0;
+       if(minus) timeInterval *= -1;
                
        NSInteger hour = timeInterval / (60 * 60);
        timeInterval -= hour * 60 * 60;
@@ -27,6 +30,6 @@
        timeInterval -= minutes * 60;
        NSInteger seconds = timeInterval;
        
-       return [NSString stringWithFormat:@"%02ld:%02ld:%02ld", hour, minutes, seconds];
+       return [NSString stringWithFormat:@"%s%02ld:%02ld:%02ld", minus ? "-" : "", hour, minutes, seconds];
 }
 @end