Either starts or ends a timer for measuring the elapsed time in seconds.
If the endFlag is 0, then the timer is started and the current elapsed time is returned. If the endFlag is 1, then the timer is stopped and the time since the last timer start is returned.
Note: | This measures elapsed time, so time is always ticking away, unlike cpu time, for which time only ticks away when the cpu is busy. |
Format
TIMER_ELAPSED (endFlag) returns REAL
Arguments
endFlag | If the endFlag is 0, then the timer is started and the current elapsed CPU is returned. If the endFlag is 1, then the timer is stopped and the elapsed CPU time since the last timer started is returned. |
Example
variable set variable=myelapse real=(eval(timer_elapsed(0)))
file command read file="mybigcmdfile.cmd"
var set var=foo string=(eval(str_print("File read took" //timer_elapsed(1)//" seconds")))