Convert a string of numbers to a NSTimeInterval

Posted by culov on Stack Overflow See other posts from Stack Overflow or by culov
Published on 2010-06-06T20:22:22Z Indexed on 2010/06/06 20:32 UTC
Read the original article Hit count: 380

Filed under:
|
|

I know I must be over-complicating this because it NSTimeInterval is just a double, but I just can't seem to get this done properly since I have had very little exposure to objective c. the scenario is as follows:

The data im pulling into the app contains two values, startTime and endTime, which are the epoch times in milliseconds. The variables that I want to hold these values are NSTimeInterval *start; NSTimeInterval *end;

I decided to store them as NSTimeIntervals but im thinking that maybe i ought to store them as doubles because theres no need for NSTimeIntervals since comparisons can just be done with a primitive. Either way, I'd like to know what I'm missing in the following step, where I try to convert from string to NSTimeInterval:

    tempString = [truckArray objectAtIndex:2];
    tempDouble = [tempString doubleValue];

Now it's safely stored as a double, but I can't get the value into an NSTimeInterval. How should this be accomplished? Thanks

© Stack Overflow or respective owner

Related posts about iphone

Related posts about c