I'm doing some extended length calculations and was wondering how I could get AbsoluteTiming to display in hours, minutes, and seconds. I googled and found nothing, so I borrowed some code, edited it, and wrote:
SetAttributes[myAbsoluteTiming, HoldAll];
myAbsoluteTiming[calculation_] :=
Module[{startTime, deltaTime, result}, startTime = SessionTime[];
result = calculation;
deltaTime = SessionTime[] - startTime;
hms = {Floor[deltaTime/3600],
Floor[Mod[Floor[deltaTime], 3600]/60],
Mod[Mod[deltaTime, 3600], 60]};
{hms, result}]
This appears to be about .0005 seconds slower than the AbsoluteTiming function.
Is that time difference accurate? Is there a better way of doing this? How would I improve upon my code?


AbsoluteTiming? It's not clear to me why you wouldn't just format the first output from that function. – dionys May 07 '16 at 18:45deltaTimes = 3700;line looks like a leftover. – Karsten7 May 07 '16 at 21:06