I am trying to calculate the average speed of the user using Core Location, so I have a total distance traveled in miles (double totalDistance) and the time elapsed (NSDate *timeElapsed).
How can I convert timeElapsed to a double displaying hours? I.e. 0.1 hours, 0.0001 hours, etc so that I can calculate my average speed correctly?
Convert the date object into a
NSTimeInterval(withtimeIntervalSinceReferenceDateortimeIntervalSinceDate:if you have a different start date), then divide theNSTimeIntervalby 3600.