title: Why is mktime() changing the year day of my tm struct?
body: <p>I read in two strings with a Year, the Julian Day (year day), hour, minute, and an observation.</p>
  
  <p>I pull the relevant variables out using sscanf:</p>
  
  <pre><code>sscanf(tide_str1.c_str(), "%d %d %d %d %Lf", &amp;y1, &amp;j1, &amp;h1, &amp;m1, &amp;obs1);
  sscanf(tide_str2.c_str(), "%d %d %d %d %Lf", &amp;y2, &amp;j2, &amp;h2, &amp;m2, &amp;obs2);
  </code></pre>
  
  <p>For this particular data set, the values are 2011 083 23 22 1.1</p>
  
  <p>I then create and populate a tm structure, and run mktime, with cout calls on the day in between and it changes from 083 to 364.</p>
  
  <pre><code>int y1=2011, j1=83, h1=23, m1=22;
  struct tm time_struct = {0, 0, 0, 0, 0, 0, 0, 0, 0}, *time_ptr = &amp;time_struct;
  time_t tv_min;
  time_struct.tm_year = y1 - 1900;
  time_struct.tm_yday = j1;
  cout &lt;&lt; time_struct.tm_yday &lt;&lt; endl;
  time_struct.tm_hour = h1;
  time_struct.tm_min = m1;
  time_struct.tm_isdst = -1;
  cout &lt;&lt; time_struct.tm_yday &lt;&lt; endl;
  tv_min = mktime(time_ptr);
  cout &lt;&lt; time_struct.tm_yday &lt;&lt; endl;
  </code></pre>
  
  <p>Why is that?  Is it because the tm_mday and and tm_mon are set to 0?  I initially tried not initializing it all to zero, but then mktime returned -1.  What should I be doing differently if I only know the year day and not the month and month day?</p>