Getting total time taken of executing a method


I want to calculate total time taken of executing a method, I have writtem a job , however it returns only till seconds. If I change the sleep to 100 it returns blank since the process took milliseconds to complete .

I want that milliseconds also if the process executes in milliseconds.

Args args;
FromTime startTime = timeNow();//DateTimeUtil::getSystemDateTime();

info(strFmt(“Total time taken To execute is %1”,timeConsumed(startTime,timeNow())));

Kindly Help

You’ve posted this twice. Anyhow, how about ticks?

ya by mistake I posted it twice … However how can I use ticks for hours,minute , seconds and milliseconds in the same job .

Never used ticks … :frowning:


Ticks are basically milliseconds. Take a look here:

So, something like this.

TimeInMS startTime,endTime;
startTime = WinAPI::getTickCount();
(do stuff)
endTime = WinAPI::getTickCount();
info(strfmt(‘%1 Milliseconds’,endTime-startTime));

Thanks :slight_smile: