Frame layer:
NSDate belongs to Foundation
Cfabsolutetimegetcurrent () belongs to Corefoundatio
Cacurrentmediatime () belongs to Quartzcore
Essential differences:
NSDate
or an CFAbsoluteTimeGetCurrent() 返回的时钟时间将会会网络时间同步,从时钟
offset angle, mach_absolute_time()
and CACurrentMediaTime()
is based on the built-in clock, can be measured more accurately and atomically, and will not change due to external time changes (such as time zone changes, summer time, second mutation, etc.), but it is related to the uptime of the system, Cacurrentmediatime () will be reset after the system restarts.
Common usage:
NSDate, CFAbsoluteTimeGetCurrent
() commonly used for the representation of daily time, timestamp, and data interaction with the server
where Cfabsolutetimegetcurrent () corresponds to [[NSDate data] timeintervalsincereferencedate];
Cacurrentmediatime () often used to test the efficiency of code
Reference article:
http://nshipster.cn/benchmarking/
http://blog.spacemanlabs.com/2011/09/all-in-the-timing-keeping-track-of-time-passed-on-ios/
The difference between nsdate, cfabsolutetimegetcurrent and Cacurrentmediatime