TIMER.Start

Previous  Next

 

status = TIMER.Start( handle AS HANDLE, 

                      bReset AS INTEGER = FALSE ) AS INTEGER

 


 

Start or restart the specified timer.  If bReset is set to TRUE, then the timer will restart from 0.  You can pause a timer by using TIME.Stop and then restart using TIMER.Start.

 

Example:

 

$LIBRARY "MyBASIC2_ExtLib"

$INCLUDE "MyBASIC2_ExtLib"

 

DIM hTimer AS HANDLE

 

' Open a Timer

hTimer = TIMER.Open()

 

IF hTimer <> MB_INVALID_HANDLE THEN

  ' Start the Timer

  TIMER.Start( hTimer )

  ' Short Delay of 1.23 seconds

  SLEEP 1.23

  ' Stop Timer

  TIMER.Stop( hTimer )

  ' Display result in Seconds and MilliSeconds

  PRINT FORMAT( "Elapsed: %1.2f s,   %1.0f ms", TIMER.Elapsed( hTimer ), TIMER.Elapsed( hTimer, 1000 ) ),

  ' Close Timer

  TIMER.Close( hTimer )

ENDIF

 

END