JavaScript Functions > Alphabetical Listing of Utility Functions (lr) > lr.startTimer

lr.startTimer

Starts a timer.

Example Informational Functions

Syntax

lr.startTimer ();

lr.startTimer starts a timer that calculates the passage of time in seconds.

lr.startTimer returns a handle to the timer. Pass the handle to lr.endTimer to stop the timer.

Return Values

Returns merc_timer_handle_t, a handle to a timer.

Parameterization

Parameterization is not applicable to this function.

Example

function Action(){

   var timer = lr.startTimer();

   /* result is in seconds */
   var timeElapsed = lr.endTimer(timer);

   lr.outputMessage("Duration = " + timeElapsed);

   /* Subtract time spent on call web_reg_save_param from all open transactions.
   Wasted time is measured in milliseconds */

   lr.wastedTime(1000 * timeElapsed);
return 0;
}