Hi, I just want to measure the time taken for the completion of process to the finest millisecond possible. Say, Start time, End time. Time difference.. If it is run as a batch process, then the time difference will be accumulated and be printed at the end. Which is the best method to implement this? Please reply ASAP Thanks & Regards, Nijeesh.
Is this is what you are asking: 1. Get start time 2. Start process 3. End process 4. Get end time 5. Calculate time between start & end 6. Repeat 7. Print out time difference when done
Is this what you were asking? [ November 26, 2002: Message edited by: David Duran ]
Joined: Oct 09, 2000
Hi David, This is what I was looking for except for the fact the difference is being returned in milliseconds. Do I have to divide and multiply to get it converted into hours/seconds/minutes.. or is it possible to do the same with some format specifier? Thanks for your reply.. Regards, Nijeesh.
Hi - If you use the long (timeDifference) in the above code like: Date d = new Date(timeDifference); then d will be some number of months, days, hours, minutes, seconds, .... since Jan 1, 1970. Ignore the year, and just look at the other fields for the elapsed time. Alternatively, there is an open source implementation of ISO8601 dates being done on sourceforge (the Joda project). Date arithmetic is reasonably straight forward. You might take a look at that. HTH, Guy