I am developing an iPhone application which stores the total time spent at a certain activity. I let the user press a button to start the activity and then stop. How can I store a value that keeps adding the time spent on the activity overall in the form of hours, minutes and seconds? (in Core Data or otherwise). For example: it can be shown like
Total time spent in a week: 08:12:05
could mean that the user spent 8 hours, 12 minutes and 5 seconds on the particular activity.
NSDate is unable to do it. I looked at NSTimer but that is kind of the opposite of what I’m looking for. I’m not thorough with all the api for iOS but is there something I can work with?
I would simply store
NSDates for start and stop time, every time the user starts the activity. The time spent can be derived from these dates with-timeIntervalSinceDate:.