title: sleep-until in c#
body: <p>I want to run a function periodically every 1 second, so after 10 seconds it is executed 10 times.
  The simplest approach is using a loop like this :</p>
  
  <pre><code>while(true)
  {
  Thread.Sleep(1000);
  function();
  }
  </code></pre>
  
  <p>But the main problem with this approach is that it will not provide any periodic guarantees. 
  I mean if it takes 0.1 seconds to run function() the executions time of the function will be like this :
  0, 1.1 , 2.2, 3.3, 4.4 , ...</p>
  
  <p>As I remember, in real time language ADA we have a function  sleep-until(#time). Now I'm looking for an  alternative in C#.</p>
  
  <p>Any sample code will be appreicated.</p>