CreateTimer
Create a timer to be used to take script timings.
Syntax
CreateTimer() As Timer
Parameters
(return)
Type: Timer object
Methods and properties
DurationInDays
Returns the duration in days since the timer started or split.
DurationInMicroSec
Returns the duration in microseconds since the timer started or split.
DurationInMilliSec
Returns the duration in milliseconds since the timer started or split.
DurationInSec
Returns the duration in seconds since the timer started or split.
Resolution
Retrieve the resolution of the timer in seconds. The resolution might be different on different hardware or operating systems.
Split()
Make Durations available. These are Durations since the most recent Split() or Start().
Start()
Start the timer.
Stop()
Stop the timer. This makes Durations available. These are Durations since the timer was started with Start().
Example
Dim Timer
Set Timer = CreateTimer()
Timer.Start()
Debug.Log("Timer Started")
Debug.Log("Timer Resolution: " + CText(Timer.Resolution) + " sec")
Sleep(20)
Timer.Split()
Debug.Log("Split time: ")
Debug.Log(Format(Timer.DurationInDays, "f3") + " days")
Debug.Log(Format(Timer.DurationInSec, "f3") + " sec")
Debug.Log(Format(Timer.DurationInMilliSec, "f3") + " ms")
Debug.Log(Format(Timer.DurationInMicroSec, "f3") + " us")
Sleep(40)
Timer.Stop()
Debug.Log("End time: ")
Debug.Log(Format(Timer.DurationInDays, "f3") + " days")
Debug.Log(Format(Timer.DurationInSec, "f3") + " sec")
Debug.Log(Format(Timer.DurationInMilliSec, "f3") + " ms")
Debug.Log(Format(Timer.DurationInMicroSec, "f3") + " us")
See also