if i use this wait function in my program:

Code:
Private Declare Function GetTickCount Lib "kernel32" () As Long

Public Sub Wait(Time As Long)
  Dim StartTime As Long
  
  StartTime = GetTickCount()
  
  While (StartTime + Time) > GetTickCount()
    DoEvents
  Wend
End Sub
i find that there is no difference between
wait(10)
and
wait(1)

i need my program to do this because i have a loop which i want to run at the same speed even on slow comps so i have programmed it so that it times how long it takes for the comp to complete the instructions in one instance of the loop and then it waits for 10 milliseconds minus the time it took to complete the instructions, for example if the instructions took 4 milliseconds, it would wait 6 milliseconds before looping round again, so the loop always takes 10 milliseconds. (except on rediculously slow comps where the instructions take more than 10 milliseconds, which isnt likely) but this isnt working because wait(10) and wait(1), wait for the same amount of time!
how can i get a more accurate wait function?