|
|
|
Slow Timer!
Some times the timer control is not fast enough to suit hour needs.
When we need to know how long a operation really took to be accomplished,
and some
operations might be very fast and we can not rely
on the timer control for knowing how fast
the code we write is.
We are going to need a Windows API function, the GetTickCount, this
functions retrieves the
number of milliseconds that have elapsed since Windows was started.
How is this is going to help me?
As we can see the GetTickCount function only returns the time elapsed since
windows started,
so if we call this function one time, this is our StartTime,
and then we call it again, this is our EndTime,
and we subtract the from the EndTime the StartTime we got the elapsed time
in milliseconds of how
long our code took to execute. The VB Now function only has precision up to
the seconds, so it might
not be good for
benchmarking small or very fast routines.
[ Slow Timer! ] [ Building the Class ]
|
|
|