In Cocoa, how would I add times for example:
1:30 (one hour and 30 minutes)
1:25 (one hour and 25 minutes)
2:15 (two hour and 15 minutes)
= 5:10
but when I get to greater then 24 hours I do not want it to go, one day x hours and y mins, I want it to continue adding the hours e.g. 25, 26, 27 … 100 hours etc. Is there already an implemented method in Cocoa?
Thanks
Add them yourself in a date components object.
When you add two seconds components together, divide by 60 to determine the number to carry to the minutes component, and use the
%operator to determine the new value of the seconds component. (For example, 73 seconds is73 / 60= 1 minute and73 % 60= 13 seconds.) Do likewise for adding minutes and carrying to hours. Then, when adding hours, just add them and don’t do any divmod magic if you don’t want to carry to the days component.