typedef uint64_t dispatch_time_t;
dispatch_time_t
1、
[NSDate dateWithTimeIntervalSinceNow:delay]
+ (dispatch_time_t)wallTimeWithDate:(NSDate *)date {
NSCParameterAssert(date != nil);
double seconds = 0;
//分解: 第二個參數:整數部分。返回值:小數部分。
12341234123412341234.818
//這兩個數的意義分別對應: 秒數, 微秒數
double frac = modf(date.timeIntervalSince1970, &seconds);
struct timespec walltime = {
.tv_sec = (time_t)fmin(fmax(seconds, LONG_MIN), LONG_MAX),
.tv_nsec = (long)fmin(fmax(frac * NSEC_PER_SEC, LONG_MIN), LONG_MAX)
};
return dispatch_walltime(&walltime, 0);
}
2、
dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC))