Description: There is a very useful function timeConsumed
() in Global class which we can use to calculate the time taken
to execute business logic in AX 2012.
It handles up to a 24 hour time difference not dependent on start/end time. If time consumed > 24 hours will only report time over 24 hour intervals.
This function will return time consumed
string in the form of X hours X minutes X seconds. If X is 0 – will not include
the value + text. This function will return time consumed string in the form of
XX hours XX minutes XX seconds (00:00:00). It handles up to a 24 hour time
difference not dependent on start/end time.
It handles up to a 24 hour time difference not dependent on start/end time. If time consumed > 24 hours will only report time over 24 hour intervals.
This code can be used to calculate the time consumed running a
process.
static void calculatetimeforrunningprocess(Args _args) { int startTime = timeNow(); int endTime; sleep(5000); endTime = timeNow(); info(strFmt("Process took %1", timeConsumed(startTime, endTime))); }
Thanks for comments.....