object-C 獲取當(dāng)前時間
// 獲得當(dāng)前的時間
NSDate * startDate = [NSDate date];
// 獲取結(jié)束時間
NSDate * endDate = [NSDate date];
NSLog(@"%f",[endDate timeIntervalSinceDate:startDate]);
C語言獲取當(dāng)前時間的代碼
// 獲得當(dāng)前時間 - 絕對時間
CFTimeInterval start = CFAbsoluteTimeGetCurrent();
// 獲得當(dāng)前時間 - 絕對時間
CFTimeInterval end = CFAbsoluteTimeGetCurrent();
NSLog(@"end - start = %f",end - start);