title: Get current hour unix timestamp
body: <p>I'd like to get the unix timestamp of the beginning of current (or any given maybe) hour in c/c++.</p>
  
  <p>I have this:</p>
  
  <pre>
  
      time_t get_current_hour() {
          time_t beginning_of_hour;
          struct tm * ptm;
  
          time(&beginning_of_hour);
  
          ptm = gmtime(&beginning_of_hour);
          ptm->tm_min = 0;
          ptm->tm_sec = 0;
          ptm->tm_zone = (char*) "GMT";
  
          beginning_of_hour = mktime(ptm);
  
          return beginning_of_hour;
      }
  
  </pre>
  
  <p>Which works, but under high load many of the result are not the beginning of the current hour but the actual time. </p>
  
  <p>Is there a better way to solve the problem?
  Why does the function returns the current time?</p>
  
  <p>Please advise,
     Akos</p>