title: Converting string containing localtime into UTC in C
body: <p>I have a string containing a local date/time and I need to convert it to a time_t value (in UTC) - I've been trying this:</p>
  
  <pre><code>char* date = "2009/09/01/00";
  struct tm cal = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL};
  strptime(date, "%Y/%m/%d/%H", &amp;cal);
  time_t t = mktime(&amp;cal);
  </code></pre>
  
  <p>but the time_t value I get back is the value that I would expect if the string was being parsed as UTC not local time. Maybe I have misunderstood what strptime is supposed to do, but in my timezone (UK) on the 1st September we are using BST (ie UTC + 1 hour) so I would expect the value I end up with to be 1 hour ahead of UTC.</p>
  
  <p>Is there a way to interpret the string as localtime, automatically taking into account the UTC offset that would have been in effect on that date? Note that I need the time_t value not a struct tm, in the example above I want the time_t value to correspond to 2009-09-01 01:00:00 GMT</p>