From aeb5222a6d7f7e9be5b737e2dbaf71185a9946db Mon Sep 17 00:00:00 2001 From: Pádraig Brady
Date: Mon, 18 Jul 2011 10:49:17 +0100 Subject: timeout: support sub-second timeouts * src/timeout.c (settimeout): A new function to convert from a floating point duration and call alarm() or timer_settime() if that's available. (parse_duration): Return a double rather than unsigned int. (usage): Mention floating point is supported. (main): Pass the double to settimeout() rather than calling alarm() directly with the parsed int. (cleanup): Likewise. * doc/coreutils.texi (timeout invocation): Say floating point timeouts now supported, and mention the caveat with resolution. * bootstrap.conf: Include the timer-time gnulib module. * tests/misc/timeout-parameters: Add a test with nanoseconds. * NEWS: Mention the improvement. --- doc/coreutils.texi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 424446c25..b406a3cfb 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -15694,7 +15694,7 @@ or a number. Also see @xref{Signal specifications}. @end table @cindex time units -@var{duration} is an integer followed by an optional unit: +@var{duration} is a floating point number followed by an optional unit: @display @samp{s} for seconds (the default) @samp{m} for minutes @@ -15702,6 +15702,8 @@ or a number. Also see @xref{Signal specifications}. @samp{d} for days @end display A duration of 0 disables the associated timeout. +Note that the actual timeout duration is dependent on system conditions, +which should be especially considered when specifying sub-second timeouts. @cindex exit status of @command{timeout} Exit status: -- cgit v1.2.3-70-g09d2