qh_nssleep()

Sleep for a specified amount of time, trying not to exceed a specified absolute time

Synopsis:

#include <qh/time.h>
int qh_nssleep(uint64_t sleep_time_ns,
               clockid_t clock_id,
               uint64_t max_absolute_time_ns)

Arguments:

sleep_time_ns
The amount of time to sleep for, in nanoseconds. Set to 0 to return right away, with EOK, ETIME or a standard errno value.
clock_id
The ID of the clock to use for the operation.
max_absolute_time_ns
The maximum absolute time (in nanoseconds) at which sleeping should stop when sleep_time_ns exceeds it (the sleep time is shortened). This time is based on the clock specified by clock_id.

Library:

qh

Description:

Sleep is governed by the clock specified by clock_id.

Returns:

EOK, ETIME, or a standard errno on failure. The errno variable is set if the return value is not EOK.

EOK
If the function slept for the amount of time specified by sleep_time_ns and has not reached the specified absolute time.
ETIME
If the time specified by max_absolute_time_ns has passed. The function may or may not have slept before it returns.