title: Getting UTC time as time_t
body: <p>I am trying to get UTC time as <code>time_t</code>. 
  Code below seems giving it correct but surprisingly prints local time only:</p>
  
  <pre><code>time_t mytime;
  
  struct tm * ptm;
  
  time ( &amp;mytime ); // Get local time in time_t
  
  ptm = gmtime ( &amp;mytime ); // Find out UTC time
  
  time_t utctime = mktime(ptm); // Get UTC time as time_t
  
  printf("\nLocal time %X (%s) and UTC Time %X (%s)", mytime,  ctime(&amp;mytime), utctime, ctime(&amp;utctime));
  </code></pre>
  
  <p>As we can see values of <code>mytime</code> and <code>utctime</code> we get are different.
  However, when passed as parameters to <code>ctime</code> it converts them to same string.</p>
  
  <blockquote>
    <p>Local time <strong>55D0CB59</strong> (Sun Aug 16 23:11:45 2015) and UTC Time <strong>55D07E01</strong>
    (Sun Aug 16 23:11:45 2015)</p>
  </blockquote>