<div dir="ltr"><div><div><div>
&gt; Of course, there&#39;s no requirement that time_t values map to times in a
linear manner...<br><br></div>From...<br>    <a href="http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/types.h.html">http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/types.h.html</a><br></div>...we have:<br>
</div>    time_t: Used for time in seconds.<br><div><br></div><div>    @dashdashado<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 7, 2013 at 12:51 PM, Clive D.W. Feather <span dir="ltr">&lt;<a href="mailto:clive@davros.org" target="_blank">clive@davros.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">Paul Eggert said:<br>
&gt; Thanks for mentioning the problem.  The code relies on undefined<br>
&gt; behavior when a time_t value is outside int_fast64_t range.<br>
&gt; It&#39;s better to avoid undefined behavior,<br>
<br>
</div><div class="im">&gt; +     if (!TYPE_INTEGRAL(time_t)) {<br>
&gt; +             if (INTMAX_MIN &lt; t &amp;&amp; t &lt; INTMAX_MAX) {<br>
<br>
</div>In principle UINTMAX_MAX could be larger than the largest value<br>
representable in time_t if it is (say) float. If so, the implicit<br>
conversion to float is undefined and you haven&#39;t solved the problem. You<br>
need to compare the various limits to decide which type can handle all the<br>
values of the other.<br>
<br>
Of course, there&#39;s no requirement that time_t values map to times in a<br>
linear manner - for example, an integral time_t could be split into bit<br>
fields holding hours, minutes, seconds, etc. That&#39;s why difftime() exists.<br>
<div class="HOEnZb"><div class="h5"><br>
--<br>
Clive D.W. Feather          | If you lie to the compiler,<br>
Email: <a href="mailto:clive@davros.org">clive@davros.org</a>     | it will get its revenge.<br>
Web: <a href="http://www.davros.org" target="_blank">http://www.davros.org</a>  |   - Henry Spencer<br>
Mobile: <a href="tel:%2B44%207973%20377646" value="+447973377646">+44 7973 377646</a><br>
</div></div></blockquote></div><br></div>