开发者

What unit of time does timeIntervalSinceDate return?

开发者 https://www.devze.com 2023-03-22 03:46 出处:网络
What unit of time does timeIntervalSinceDate return? Is it seconds, milliseconds or something else? The documentation says that it returns an NSTimeInterval, but what unit of time is that开发者_如何转

What unit of time does timeIntervalSinceDate return? Is it seconds, milliseconds or something else?

The documentation says that it returns an NSTimeInterval, but what unit of time is that开发者_如何转开发 value?


It returns the number of seconds, as an NSTimeInterval value.

From this documentation page:

NSTimeInterval is always specified in seconds; it yields sub-millisecond precision over a range of 10,000 years.


Well the NSDate docs show the function prototype as:

- (NSTimeInterval)timeIntervalSinceDate:(NSDate *)anotherDate

And the Foundation Data Types doc states:

NSTimeInterval is always specified in seconds; it yields sub-millisecond precision over a range of 10,000 years.

0

精彩评论

暂无评论...
验证码 换一张
取 消