GetTimer Function |
Microsoft.VisualBasic.VBMath
GetTimer( )
A Double indicating the number of seconds
Returns the number of seconds since midnight
You can use the GetTimer function as an easy method of passing a seed number to the Randomize procedure, as follows :
Randomize GetTimer( )
The GetTimer function is ideal for measuring the time taken to execute a procedure or block of code, as the following snippet shows:
Dim dblStartTime As Double Dim i As Integer dblStartTime = Timer( ) For I = 1 to 100 Console.WriteLine("Hello") Next Console.WriteLine("Time Taken = " & GetTimer( ) - _ dblStartTime & " Seconds")
The GetTimer function is new to VB.NET. However, it is functionally identical to the VB 6 Timer function (and VB.NET Timer property), which continues to be supported.
In contrast to the VB 6 Timer function, which returned a Single, the VB.NET GetTimer function and Timer property return a Double.
Timer Property