Elapsed Property

See Also  Examples  Applies to

Returns the number of milliseconds elapsed since creation of the Stopwatch object or invocation of its Reset method.

Syntax

value As Long = ccrpStopWatch.Elapsed

Remarks

The StopWatch object works by calling the timeGetTime API at initialization and whenever its Reset method is called, and then storing this time for future use. When you query the Elapsed property of a StopWatch object, timeGetTime is called again and the initialization time is subtracted from this new value, thus returning the number of milliseconds since the first time was stored.

Query the Elapsed property whenever you need to know how long it's been since the StopWatch was initialized. The StopWatch object is extremely useful for benchmarking your code. (See Editorial: No More Lame Benchmarks! for one technique.)

Data Type

Long