title: What happens when I apply an offset to one part of this date output?
body: <p>I am trying to write a function that takes in a parameter which is the offset days, and returns the date those many offset days from now. I can easily get the current date from below</p>
  
  <pre><code>#include &lt;ctime&gt;
  #include &lt;iostream&gt;
  using namespace std;
  
  int main() {
  time_t t = time(0);   // get time now
  struct tm * now = localtime( &amp; t );
  cout &lt;&lt; (now-&gt;tm_year + 1900) &lt;&lt; '-' 
       &lt;&lt; (now-&gt;tm_mon + 1) &lt;&lt; '-'
       &lt;&lt;  now-&gt;tm_mday
       &lt;&lt; endl;
  }
  </code></pre>
  
  <p>My question is if I change the now->tm_mday to now->tm_mday - offset, is it smart enough to do the month change or the year change as they may change.</p>