计算两个NSDate之间,相隔多少秒数
//两个时间间隔秒数
- (NSInteger)intervalSecondsWithSmallDate:(NSDate*)smallDate bigDate:(NSDate*)bigDate
{
NSCalendar *calendar =[NSCalendar currentCalendar];
unsigned int unitFlags =kCFCalendarUnitYear|kCFCalendarUnitMonth|kCFCalendarUnitDay|kCFCalendarUnitHour|kCFCalendarUnitMinute|kCFCalendarUnitSecond;
NSDateComponents *dateComp= [calendar components:unitFlags fromDate:smallDate toDate:bigDate options:0];
NSInteger second = [dateComp hour]*3600+[dateComp minute]*60+[dateComp second];
return second;
}