convert timeval structure to c#

1.4k views Asked by At

I know this question may be so simple, I have the following code and it should be converted to C#, but the main problem is that I can not understand what below code is doing exactly!!!!...I've searched but I did not find any thing..I Think may be the timeval structure and the select function can be removed with out any consequences!! Am I right?? If no, then How can I convert it to C#??? what is the responsibility of select function exactly?? thanks in advanced.

void WaitMs(UInt32 milliSeconds)
    {
        //start of problem
        struct timeval t=
        { milliSeconds/1000, 
          (milliSeconds%1000)*1000 
        };
        Select(0,NULL,NULL,NULL,&t);
        UInt32 temp=milliSeconds;
     //end of problem
        Logger.NewWait(temp);
    }

I think the code between start of problem and end of problem is not necessary at all! true??

1

There are 1 answers

3
Ilya Tereschuk On BEST ANSWER

Time and date values are always transferred by milliseconds value.

For C#:

In C++ there is also a way to do it.

In C#, causing a delay, as Select function does in your code, is made by Thread.Sleep call.