diff --git a/Window/PositionSlider.m b/Window/PositionSlider.m index d857af3e7..790cd72d1 100644 --- a/Window/PositionSlider.m +++ b/Window/PositionSlider.m @@ -13,21 +13,21 @@ - (void)setDoubleValue:(double)value { - self.positionTextField.currentTime = (long)value; + self.positionTextField.currentTime = value; [super setDoubleValue:value]; } - (void)setMaxValue:(double)value { - self.positionTextField.duration = (long)value; + self.positionTextField.duration = value; [super setMaxValue:value]; } - (void)mouseDragged:(NSEvent *)theEvent { - self.positionTextField.currentTime = (long)[self doubleValue]; + self.positionTextField.currentTime = [self doubleValue]; [super mouseDragged:theEvent]; } diff --git a/Window/TimeField.h b/Window/TimeField.h index fd709e4b7..4e6f07b3a 100644 --- a/Window/TimeField.h +++ b/Window/TimeField.h @@ -11,7 +11,7 @@ @interface TimeField : NSTextField -@property (nonatomic) NSInteger currentTime; -@property (nonatomic) NSInteger duration; +@property (nonatomic) NSTimeInterval currentTime; +@property (nonatomic) NSTimeInterval duration; @end diff --git a/Window/TimeField.m b/Window/TimeField.m index ebdb38c94..e6d68bf8d 100644 --- a/Window/TimeField.m +++ b/Window/TimeField.m @@ -10,8 +10,8 @@ static NSString *kTimerModeKey = @"timerShowTimeRemaining"; -NSString * formatTimer(long minutes, long seconds, unichar prefix) { - return [NSString localizedStringWithFormat:@"%C%lu:%02lu", prefix, minutes, seconds]; +NSString * formatTimer(NSTimeInterval minutes, NSTimeInterval seconds, char *prefix) { + return [NSString localizedStringWithFormat:@"%s%02u:%02u", prefix, (unsigned)minutes, (unsigned)seconds]; } @implementation TimeField { @@ -35,13 +35,13 @@ NSString * formatTimer(long minutes, long seconds, unichar prefix) { NSString *text; if (showTimeRemaining == NO) { - long sec = self.currentTime; - text = formatTimer(sec / 60, sec % 60, 0x2007); // Digit-width space + NSTimeInterval sec = self.currentTime; + text = formatTimer(sec / 60, fmod(sec, 60), ""); // No prefix. } else { - long sec = MAX(0, self.duration - self.currentTime); - text = formatTimer(sec / 60, sec % 60, 0x2012); // Hyphen + NSTimeInterval sec = MAX(0.0, self.duration - self.currentTime); + text = formatTimer(sec / 60, fmod(sec, 60), "-"); // Hyphen-minus. } NSAttributedString *string = [[NSAttributedString alloc] initWithString:text attributes:fontAttributes]; @@ -55,7 +55,7 @@ NSString * formatTimer(long minutes, long seconds, unichar prefix) { [self update]; } -- (void)setCurrentTime:(NSInteger)currentTime +- (void)setCurrentTime:(NSTimeInterval)currentTime { _currentTime = currentTime; [self update];