Quote:
Originally Posted by elfarez
Ok, I know realise the problem the current time uses the intValue method. Does anyone know the method for decimal values?
|
All of Cocoa's date functions use either NSDate or NSTimeInterval. NSTimeInterval is a double precision floating point number, accurate to a few thousandths of a second.
It's probably YOUR code that uses an intValue. Post the code that is returning integer values and perhaps we can help you.
Code like this
Code:
NSTimeInterval startTime, endTime, elapsedTime;
startTime = [NSDate timeIntervalSinceReferenceDate];
... Do stuff that takes time...
endTime = [NSDate timeIntervalSinceReferenceDate];
elapsedTime = endTime - startTime;
NSLog(@"Elapsed time = %f seconds", elapsedTime);
Should let you calculate time in fractions of a second.