I need my program to wait for about 1ms. To do that I use:
System.Threading.Thread.Sleep(1)
But is about 10 times Slower.
In the following program:
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
for (int i = 0; i < 1000; i++ )
System.Threading.Thread.Sleep(1);
Console.WriteLine(stopWatch.ElapsedMilliseconds);
I get as output: 15110
.
Is there a way to stop for just 1ms?
UPDATE 1: Why I need to do this
In the company where I work, there's a machine (CNC Plasma) controlled by a PC. Somebody has protected the config area by a password and nobody remembers the password. Since the password can only be entered by mouse, I'm am writting a force brute program to get that password.
The problem is that I need to wait for about 1ms between each entered digit.
UPDATE 2: There's a similar question but is not solved :(