title: Generating wrong Unix timestamp
body: <p>I am trying to get the timestamp for some date, currently I'm using the function <code>mktime()</code> but it is generating the timestamp for the current date, not the one I put in the input. Here is the code:</p>
  
  <pre><code>#include &lt;ctime&gt;
  #include &lt;iostream&gt;
  using namespace std;
  
  long long unixTimeStamp(
      int year,
      int month,
      int day,
      int hour,
      int min,
      int sec
    ) {
  
    tm uts_time;
    uts_time.tm_year = year - 1900;
    uts_time.tm_mon = month - 1;
    uts_time.tm_mday = day;
    uts_time.tm_sec = sec;
    uts_time.tm_min = min;
    uts_time.tm_hour = hour;
  
    time_t out = mktime(&amp;uts_time);
  
    return time(&amp;out);
  }
  
  int main() {
    cout &lt;&lt; unixTimeStamp(2010,8,29,1,22,9) &lt;&lt; endl;
    return 0;
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>1362541046
  </code></pre>
  
  <p>Can somebody tell me what am I doing wrong?</p>