[PATCH] manual: Add a comparative example of 'clock_nanosleep' use

Florian Weimer fweimer@redhat.com
Wed Jun 4 17:11:35 GMT 2025


* Maciej W. Rozycki:

> Add an illustrative example of how to express 'nanosleep' in terms of
> 'clock_nanosleep'.
> ---
>  manual/time.texi |   13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> glibc-doc-clock-nanosleep-example.diff
>
> Index: glibc/manual/time.texi
> ===================================================================
> --- glibc.orig/manual/time.texi
> +++ glibc/manual/time.texi
> @@ -3241,6 +3241,19 @@ different from @code{nanosleep}, which r
>  sets the global variable @code{errno} according to the error encountered
>  instead.
>  
> +Except for the return value convention and the way to communicate an error
> +condition the call:
> +
> +@smallexample
> +nanosleep (@var{requested_time}, @var{remaining_time})
> +@end smallexample
> +
> +is analogous to:
> +
> +@smallexample
> +clock_nanosleep (CLOCK_REALTIME, 0, @var{requested_time}, @var{remaining_time})
> +@end smallexample
> +
>  The @var{clock} argument specifies the clock to use.
>  @xref{Getting the Time}, for the @code{clockid_t} type and possible values
>  of @var{clock}.  Not all clocks listed are supported for use with

Looks good.

Reviewed-by: Florian Weimer <fweimer@redhat.com>

Thanks,
Florian



More information about the Libc-alpha mailing list