What unit of time does timeIntervalSinceDate return?

Objective CNsdate

Objective C Problem Overview


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?

Objective C Solutions


Solution 1 - Objective C

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.

Solution 2 - Objective C

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMosheView Question on Stackoverflow
Solution 1 - Objective CesqewView Answer on Stackoverflow
Solution 2 - Objective CGarlicFriesView Answer on Stackoverflow