I am having a terrible time trying to do something that should be easy. I have a NSNumber value of 32025.89 seconds. I need to represent that in Hours, Minutes, Seconds. Is
Here's a way without any libraries except for modf() from math.h:
modf()
math.h
float fsec = 32025.89f, frac = 0; int milliseconds = (int)(modf(fsec, &frac) * 1000); int isec = (int)frac; int hours = isec / 3600; int minutes = (isec % 3600) / 60; int seconds = isec % 60;