What are the limits of std::tm or std::gmtime?
<p><code>std::gmtime</code> is failing for me when I pass it the max possible <code>std::time_t</code>. See the following test:</p>

<pre><code>std::cout   &lt;&lt; "sizeof(std::time_t): " &lt;&lt; sizeof(std::time_t) &lt;&lt; '\n'
            &lt;&lt; "sizeof(long long): " &lt;&lt; sizeof(long long) &lt;&lt; '\n'
            &lt;&lt; "sizeof(unsigned int): " &lt;&lt; sizeof(unsigned int) &lt;&lt; "\n\n";

auto testgmtime = [](std::time_t time)
{
    std::tm* ptm = std::gmtime(&amp;time);
    std::cout &lt;&lt; (ptm ? "succeeded\n" : "failed\n");
};

testgmtime(std::numeric_limits&lt;std::time_t&gt;::max());
testgmtime(std::numeric_limits&lt;long long&gt;::max());
testgmtime(std::numeric_limits&lt;long long&gt;::max()-1);
testgmtime(static_cast&lt;std::time_t&gt;(std::numeric_limits&lt;unsigned int&gt;::max())*2);
testgmtime(std::numeric_limits&lt;int&gt;::max());
</code></pre>

<p><strong>Output:</strong></p>

<pre><code>sizeof(std::time_t): 8
sizeof(long long): 8
sizeof(unsigned int): 4

failed
failed
failed
succeeded
succeeded
</code></pre>

<p>I'm using VS2012. Is there a standard limit I'm not seeing or is this VS being crappy? What alternative can I use that <em>works</em>?</p>
