There doesn't seem to be a class in Java to calculates duration in hours, minutes, seconds, milliseconds, etc.
Take the curent code snippet...
long startTime = System.currentTimeMillis();
boolean done = false;
// code to perform some operation...
// that set's dome to true when complete
long endTime = System.currentTimeMillis();
long duration = endTime - startTime;
At this point, the duration variable holds the number of
milliseconds it took for the process to complete. But what class can I put this into to convert it to days, hours, minutes, seconds, etc.?
My first thought was to put it into Date, and then use a GregorianCalendar to get the individial fields. That didn't work becuase it uses GMT time zone as the basis, and I am in CST time zone - which means all of my times were off by 6 hours.
I'm sure I can write a work around for this, but I would like to think that Sun has provided something to do this. I would rather use their solution, than my own.
Anyone know of a class that does this?