iOS.GetCurrentTimestamp
2014-07-01 17:51
555 查看
Cocoa 中测量时间的方法
1. The Methods to Get Current Timestamp
iOS中获取时间戳的方法:A. CACurrentMediaTime()
B. gettimeofday
C. CFAbsoluteTimeGetCurrent
D. [NSDate date] timeIntervalSince1970]
E. mach_absolute_time()
Ref[1]对比了以上方法的耗时,但是其准确性需要验证。
2. Clock Time
时钟时间"CFAbsoluteTimeGetCurrent [NSDate timeIntervalSinceReferenceDate] return clock time.
Clock time is synchronized with the network time signal. So, they are not suitable for timestamp." Ref[2]
3. 各种方法的对比以及适用场景
3.1 对于测量App中某些操作的所消耗的时间,用CACurrentMediaTime()来说很合适。Reference
1. http://stackoverflow.com/questions/358207/iphone-how-to-get-current-milliseconds2. Tip: CACurrentMediaTime
http://www.alexcurylo.com/blog/2009/09/05/tip-cacurrentmediatime/
3. iOS.mach_absolute_time
4. Benchmarking
http://nshipster.com/benchmarking/ http://nshipster.cn/benchmarking/
5. ‘CACurrentMediaTime()’
http://bendodson.com/weblog/2013/01/29/ca-current-media-time/
Todo
1. Timers, Clocks, and Cocoahttp://devetc.org/code/2014/01/21/timers-clocks-and-cocoa.html
2.
http://www.raywenderlich.com/forums/viewtopic.php?f=2&t=1019
3. All in the Timing: Keeping Track of Time Passed on iOS
http://blog.spacemanlabs.com/2011/09/all-in-the-timing-keeping-track-of-time-passed-on-ios/
4. How to convert mach_absolute_time() into seconds?
相关文章推荐
- ios-CFAbsoluteTimeGetCurrent和CACurrentMediaTime以及NSDate
- API GetCurrentTime Dem Lincod1
- API GetCurrentTime Well, itd1
- GetCurrentTime(),GetLocalTime(),GetSystemTime()之间的区别
- API GetCurrentTime Now, Jim,d1
- API GetCurrentTime After the d1
- API GetCurrentTime O, I unded1
- API GetCurrentTime O! certaid1
- GetCurrentTime的用法
- API GetCurrentTime In Which td1
- API GetCurrentTime The child d1
- CTime::GetCurrentTime();获取当前时间
- API GetCurrentTime I know itd1
- API GetCurrentTime Well, Emid1
- MyGetCurrentTime 驱动获取当前时间
- API GetCurrentTime Here, youd1
- API GetCurrentTime Chapter 5Sd1
- GetSystemTime,GetLocalTime,GetCurrentTime异同分析
- m_Time = CTime::GetCurrentTime();
- API GetCurrentTime George wasd1