title: Converting Between Local Times and GMT/UTC in C/C++
body: <p>What's the best way to convert datetimes between local time and UTC in C/C++?</p>
  
  <p>By "datetime", I mean some time representation that contains date and time-of-day.  I'll be happy with <code>time_t</code>, <code>struct tm</code>, or any other representation that makes it possible.</p>
  
  <p>My platform is Linux.</p>
  
  <p>Here's the specific problem I'm trying to solve: I get a pair of values containing a julian date and a number of seconds into the day.  Those values are in GMT.  I need to convert that to a local-timezone "YYYYMMDDHHMMSS" value.  I know how to convert the julian date to Y-M-D, and obviously it is easy to convert seconds into HHMMSS.  However, the tricky part is the timezone conversion.  I'm sure I can figure out a solution, but I'd prefer to find a "standard" or "well-known" way rather than stumbling around.</p>
  
  <hr>
  
  <p>A possibly related question is <a href="https://stackoverflow.com/questions/678445/get-daylight-saving-transition-dates-for-time-zones-in-c">Get Daylight Saving Transition Dates For Time Zones in C</a></p>