Re: libc difftime() miscomputes negative representable time_t values on amd64

Todd C. Miller <[email protected]> Wed, 22 Apr 2026 19:09:36 -0600
Newsgroups gmane.os.openbsd.bugs
Message-ID <[email protected]>
On Wed, 22 Apr 2026 10:13:49 -0600, Todd C. Miller wrote:

> Your analysis is correct.  The result of the bitwise AND is unsigned
> so we need to cast back to time_t before the cast to double.
>
> With this change I get the expected result from your test
> program:
>
>     sizeof(time_t)=8
>     difftime(0, -86400) = 86400

I committed the fix.

 - todd
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.