I’m trying to avoid creating an NSDate object since my code is heavy in needing the ‘current time’. I end up calling [[NSDate date] timeIntervalSince1970] a lot. Is there any way to get the time interval without instantiating the object?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
CFAbsoluteTimeGetCurrentgives you similar accuracy – no object required.CFAbsoluteTimeGetCurrentuses a different base (or reference date), so you will have to initially determine the offset or the bases if you need to use another reference date (e.g. relative to some time in 1970).