views:

191

answers:

1

I have a subtitle text file that works with standart srt format 00:00:00,000 Hour, minutes, seconds, milliseconds.

I want to create a timer to update the subtitle screen and check the current time to know what subtitle show on screen.

Which is the best to use? NSTimeInterval, NSDate? I think the best is to convert all to times to milliseconds number and compare. But NSTimeInterval works with seconds, not milliseconds.

Some clue?

Marcos

+2  A: 

NSTimeInterval is likely what you want. NSTimeInterval is in units of seconds, but has a fractional portion which can represent sub-millisecond values (it's typedef'ed to a double). Thus a value of 2.5 represents 2 seconds + 500ms.

In fact, NSTimer uses NSTimeInterval

+ (NSTimer*)scheduledTimerWithTimeInterval:(NSTimeInterval)seconds
                                invocation:(NSInvocation*)invocation
                                   repeats:(BOOL)repeats;
nall