Timestamp and Subtract Target C

I need to find the specific time when the tap occurs, and then the time elapsed since it passed. I have a crane counting application, I just did not understand the time.

I tried:

timeStamp = [[NSDate date] timeIntervalSince1970]; 

but I'm new to obj c and obviously there is a syntax issue.

Thanks for any help.

+3
source share
2 answers

If you are trying to find the amount of time that has passed since the event, I create an NSDate timestamp when this event occurs:

NSDate *timestamp = [NSDate date];

Then, then, to check how much time has passed since the times you can call:

NSTimeInterval interval = [timestamp timeIntervalSinceNow];

NSTimeInterval - typedef. , . . ( , , .)

+6

, , timeStamp.

:

NSTimeInterval timeStamp;
0

Source: https://habr.com/ru/post/1770944/


All Articles