icscott
icscott

Reputation: 1

cant initialize NSTimeInterval with timeIntervalSince1970

I'm trying to initialize an NSTimeInterval with this code:

NSTimeInterval *timeStamp = [[NSDate date] timeIntervalSince1970];

but it keeps throwing an error:

Initializing 'NSTimeInterval *' (aka 'double *') with an expression of incompatible type 'NSTimeInterval' (aka 'double')

How do i fix this?

Upvotes: 0

Views: 720

Answers (1)

rmaddy
rmaddy

Reputation: 318854

NSTimerInterval is a primitive type, not an object type. No need for the pointer, just as the error states. You want:

NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970];

Upvotes: 7

Related Questions