Returns the current system absolute time.
CFAbsoluteTime CFAbsoluteTimeGetCurrent ();
Return Value
The current absolute time.
Discussion
Absolute time is measured in seconds relative to the absolute reference date of Jan 1 2001 00:00:00 GMT. A positive value represents a date after the reference date, a negative value represents a date before it. For example, the absolute time -32940326
is equivalent to December 16th, 1999 at 17:54:34. Repeated calls to this function do not guarantee monotonically increasing results. The system time may decrease due to synchronization with external time references or due to an explicit user change of the clock.
如果您的 iPhone 应用里需要加入时差计算功能,比如手指滑动的时间,下面这行代码一定派得上用场:
CFTimeInterval time = CFAbsoluteTimeGetCurrent();
当然你也可以纪录开始接触和手指离开的时间,二者相减便是时差
time1 = [touch timestamp];
time2 = [touch timestamp];
时间差 = time2 - time1;