Why should I set the month number to the actual month when passing to mktime?
<pre><code>#include &lt;time.h&gt;
#include &lt;iostream&gt;
int main()
{

        struct tm dayofmonth = {0};
        int iYear = 2012;
        int iMonth = 2; // February

        dayofmonth.tm_year = iYear - 1900;
        dayofmonth.tm_mon =  iMonth;
        dayofmonth.tm_mday = 0;
        dayofmonth.tm_isdst = 0;

        mktime(&amp;dayofmonth);

        std::cout &lt;&lt; "Number of days for the month " &lt;&lt; dayofmonth.tm_mon &lt;&lt; " is " &lt;&lt; dayofmonth.tm_mday &lt;&lt; std::endl;

}
</code></pre>

<p>Needed to write a simple routine, to find the number of days for a given month. However, for mktime, why should I pass the actual month number instead of month number -1.</p>

<p>It is more confusing, that after calling mktime, the tm_mon returns month -1 instead of the original month that was passed.</p>
