0
我正在使用NSTimer,我正在努力顯示分鐘和秒鐘。但我對計算小時數所需的數學感到困惑。NSTimer計算小時
我使用:
- (void)updateCounter:(NSTimer *)theTimer {
static int count = 0;
count += 1;
int seconds = count % 60;
int minutes = (count - seconds)/60;
// Not sure how to calculate hours
int hours = (count - minutes)/60;
self.timer.text = [NSString stringWithFormat:@"%.2d:%.2d:%.2d", hours, minutes, seconds];
}
我應該使用什麼計算時間?