Subject: Re: bug#77535: timeout treats very short durations as `0`

From: Pádraig Brady <[email-masked]>
Date: Mon, 7 Apr 2025 18:46:31 +0100

On 07/04/2025 09:08, Paul Eggert wrote:
> On 2025-04-05 13:56, Pádraig Brady wrote:
>> I'm going to apply the attached later to remove the libm dependency.
>> It's just too much of a dependency for minimal functionality.
> 
> Thanks, agreed about the dependency. Still, 'timeout' (and, now that I
> think about it, 'sleep' and 'tail') should always wait for at least the
> time requested.
> 
> After thinking about it I installed the attached further patch, which
> addresses the problem in a different way without needing libm on
> GNU/Linux. Although we could tighten the bounds further in typical cases
> (by using the algorithm 'date' uses to parse seconds, if the string is
> of that form) I tried to keep it simple, as the main point is to not
> sleep for less than the time requested.
> 
> Floating point can be such a pain sometimes, even for simple things.
> (Read the cited paper and see....)

Nice.
I hadn't realized gnulib's signbit avoided the dependency on libm.

thanks!
Pádraig