CFTimeInterval _ticks;
_ticks += 0.1;
double seconds = fmod(_ticks, 60.0);
double minutes = fmod(trunc(_ticks / 60.0), 60.0);
double hours = trunc(_ticks / 3600.0);
self.timerLabel.text = [NSString stringWithFormat:@"%02.0f:%02.0f:%04.1f", hours, minutes, seconds];
NSLog(@"tick = %f text = %@", _ticks, self.timerLabel.text);
2014-09-24 02:59:49.241 TabbedBanner[961:60b] tick = 0.100000 text = 00:00:00.1
2014-09-24 02:59:49.341 TabbedBanner[961:60b] tick = 0.200000 text = 00:00:00.2
2014-09-24 02:59:49.441 TabbedBanner[961:60b] tick = 0.300000 text = 00:00:00.3
...
2014-09-24 02:59:53.141 TabbedBanner[961:60b] tick = 4.000000 text = 00:00:04.0
2014-09-24 02:59:53.241 TabbedBanner[961:60b] tick = 4.100000 text = 00:00:04.1
2014-09-24 02:59:53.341 TabbedBanner[961:60b] tick = 4.200000 text = 00:00:04.2
2014-09-24 02:59:53.441 TabbedBanner[961:60b] tick = 4.300000 text = 00:00:04.3
...
2014-09-24 03:03:35.186 TabbedBanner[961:60b] tick = 224.900000 text = 00:03:44.9
2014-09-24 03:03:35.286 TabbedBanner[961:60b] tick = 225.000000 text = 00:03:45.0
2014-09-24 03:03:35.386 TabbedBanner[961:60b] tick = 225.100000 text = 00:03:45.1
2014-09-24 03:03:35.486 TabbedBanner[961:60b] tick = 225.200000 text = 00:03:45.2
2014-09-24 03:03:35.586 TabbedBanner[961:60b] tick = 225.300000 text = 00:03:45.3
2014-09-24 03:03:35.686 TabbedBanner[961:60b] tick = 225.400000 text = 00:03:45.4
댓글 없음:
댓글 쓰기