I have a situation where I do not want to perform a certain function too quickly. I have this code:
DoSomething();
Thread.Sleep(TimeSpan.FromMilliseconds(200));
How can I change this code to run the maximum function time or timeout?
Please note: I cannot use the system time because my software can change the hours of operation of the clock.
So, if it DoSomething()takes 400 MS, it will wait for 400 MS, but if it takes 100 MS, the program will wait for 200 MS.
source
share