NSDate *now = [NSDate date];
NSString *dateString = [self.dateFormatter stringFromDate:now];
NSTimeInterval todaysDiff = [[self.dateFormatter dateFromString:dateString] timeIntervalSinceNow];
NSTimeInterval dateDiff = lastDiff - todaysDiff;
div_t h = div(dateDiff, 3600);
int hours = h.quot;
// Divide the remainder by 60; the quotient is minutes, the remainder
// is seconds.
div_t m = div(h.rem, 60);
int minutes = m.quot;
timeTag.text = [NSString stringWithFormat:@" %d:%d",hours,minutes];
No comments:
Post a Comment