class AW
{
[DllImport("kernel32.dll")]
static extern int GetTickCount();
static void Main()
{
int timer;
int interval = 20;
int start = GetTickCount();
for (timer = 0; timer < 5000; timer += interval)
{
Console.WriteLine("sum1337text");
Thread.Sleep(interval);
}
int end = GetTickCount();
}
int tickStart = GetTickCount(); // Right now.
int tickEnd = tickStart + 5000; // 5 seconds into the future
while(GetTickCount() < tickEnd)
{
// Do nothing, although it's better to Sleep(0) in here to not waste CPU time.
}
MessageBox.Show("Hurraiiii, 5 seconds have passed.");

