title: c++ call function every 5 minutes
body: <p>I wanted to call function every 5 minutes<br>
  I tried</p>
  
  <pre><code>AutoFunction(){
      cout &lt;&lt; "Auto Notice" &lt;&lt; endl;
      Sleep(60000*5);
  }
  
  while(1){
  
      if(current-&gt;tm_hour == StartHour &amp;&amp; current-&gt;tm_min == StartMinut &amp;&amp; current-&gt;tm_sec == StartSec){
          CallStart();
      }
  
      AutoFunction();
      Sleep(1000);
  }
  </code></pre>
  
  <p>I want refresh the <code>while</code> every 1 second  and at the same time <code>call AutoFunction()</code>; every 5 minutes, but without waiting the <code>Sleep</code> in AutoFunction</p>
  
  <p>because I have to refresh the while(1) every 1 sec to check time to start another function</p>
  
  <p>I thought to do it like</p>
  
  <pre><code>while(1){
  
      if(current-&gt;tm_hour == StartHour &amp;&amp; current-&gt;tm_min == StartMinut &amp;&amp; current-&gt;tm_sec == StartSec){
          CallStart();
      }
  
      Sleep(1000);
  }
  while(1){
  
      AutoFunction();
      Sleep(60000*5);
  }
  </code></pre>
  
  <p>but I don't think so both will working together</p>
  
  <p>Thank You</p>