当前位置:首页 > 操作系统 > Ios

iOS.GetCurrentTimestamp

The Methods to Get Current Timestamp

A. CACurrentMediaTime()

B. gettimeofday

C. CFAbsoluteTimeGetCurrent

D. [NSDate date] timeIntervalSince1970]

E. mach_absolute_time() 

 

Clock Time:

CFAbsoluteTimeGetCurrent [NSDate timeIntervalSinceReferenceDate] return clock time.

Clock time is synchronized with the network time signal. So, they are not suitable for timestamp.

 

Todo:

1. How to convert mach_absolute_time() into seconds?

 

Reference:

1. http://stackoverflow.com/questions/358207/iphone-how-to-get-current-milliseconds

2. http://www.alexcurylo.com/blog/2009/09/05/tip-cacurrentmediatime/

原文:http://www.cnblogs.com/cwgk/p/3818853.html


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!