Home > Language Reference > Response Time Functions > Timer

Timer

The Timer function returns the value of the specified clock.

Usage

Used to measure the time that elapsed between a StartTimer call and a StopTimer call.

Syntax

result=Timer(<clock_number>)

Parameters

<clock_number>, constant, integer from 1 to 10, clock number.

Return value

The return value is the time in 1/100 second that elapsed between the StartTimer(<clock_number>) call and the StopTimer(<clock_number>) call in the script. 

Remarks

If <clock_number> is invalid, the standard Error Handling applies (see article Error Handling Overview).

As system time is not accurate enough to measure 1/1000 sec, WinTask x64 Timers have a maximum precision of 1/100 second.

See also

ResetTimer
StartTimer
StopTimer

Examples

'This script measures a connection time: connection is supposed achieved
'when the text "connected" is displayed in the emulator window (window name : my_emulator$).
ResetTimer(1)
'After having reset clock number 1, start clock number 1
StartTimer(1)
Pause until
     Text("connected")
     InWindow(my_emulator$)
EndPause
'Stop the timer
StopTimer(1)
'Timer function returns the result as a number in 1/100 sec.
Comment("connection made in : "+str$(Timer(1)/10))

'This script measures how long it takes for a page on our demonstration web site
ResetTimer(1)
StartBrowser("IE", "www.wintask.com/demos
")
UsePage("WinTask Demonstration Pages")
StartTimer(1)
ClickHTMLElement("A[INNERTEXT= 'Form']")

UsePage("Form")
'Stop the timer
StopTimer(1)
'Timer function returns the result as a number in 1/100 sec.
msgbox("Page How it works loaded in : "+str$(Timer(1))+" hundreds of a sec")