clock_gettime() if you have a POSIX system. Not sure C# has that, but most OSs support it, and would allow you to check the current time. i.e. sleep and then check. Don't expect to be able to accurately delay in milliseconds like in your example, since you can't guarantee that other processes won't pre-empt. Generally, avoid using delays in your apps.
You could make a timer,say Mytimer1,put a variable name it mycounter have it increased by one till 1000
enable this timer,then start the timer then enter an infinit loop
Code:
for(;;)
{
if (mycounter == 999)
{
//do what you want to do
break;
}
}
the program will be trapped inside infinit loop till mycounter become 999,this make a delay time period call it x
you could measure this x varible in time units using the above formula written by btbass