So I have an NSTimer and im using a date formatter to pause and play the timer but when i start the timer it starts at 07:00:00 when i want it to start at 00:00:00.
My timer code is
-(void) updateTimer {
NSDate *currentDate = [NSDate date];
NSTimeInterval timeInterval = [currentDate timeIntervalSinceDate:startDate];
NSDate *timerDate = [NSDate dateWithTimeIntervalSince1970:timeInterval];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateFormat = @"hh:mm:ss";
//[dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0.0]];
NSString *timeString = [dateFormatter stringFromDate:timerDate];
hhmmssLabel .text = timeString;
pauseTimeInterval = timeInterval;
}
-(void)pauseTimer {
[tickerTimer invalidate];
tickerTimer = nil;
[self updateTimer];
}
-(void) unPauseTimer {
startDate = [NSDate date] ;
startDate = [startDate dateByAddingTimeInterval:((-1)*(pauseTimeInterval))];
tickerTimer = [NSTimer scheduledTimerWithTimeInterval:1.0/1.0 target:self selector:@selector(updateTimer) userInfo:nil repeats:YES];
}
Im assuming it has to do with the time zone so i commented it out which didnt help. I can't get it to start at 00:00:00