title: Run program for 3 seconds
body: <p>I'm trying to run a small piece of code for 3 seconds:
  Example:</p>
  
  <pre><code>WHILE(3 SECONDS){
    printf("Hey");
  }
  </code></pre>
  
  <p>I've tried to use time_t, counting some time till I reach a limit, like this:</p>
  
  <pre><code>time_t endwait;
  time_t atual = (unsigned int)time(NULL);
  time_t duration = secs;
  
  while(atual &lt; endwait){
    printf("Hey");
  }
  </code></pre>
  
  <p>But it's not working, the program is stuck in a loop printing "Hey".</p>