Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/c/clock_nanosleep.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/c/clock_nanosleep.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/c/clock_nanosleep.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/c/clock_nanosleep.html on line 8

clock_nanosleep()

High resolution sleep with specifiable clock

Synopsis:

#include <time.h>

int clock_nanosleep( clockid_t clock_id,
                     int flags,
                     const struct timespec * rqtp,
                     struct timespec * rmtp );

Arguments:

clock_id
The ID of the clock to use to measure the time. The possible clock types are:

The clock_nanosleep() function fails if the clock_id argument refers to the CPU-time clock of the calling thread.

flags
Flags that specify when the current thread is to be suspended from execution:

Calling clock_nanosleep() with TIMER_ABSTIME not set, and clock_id set to CLOCK_REALTIME is the equivalent to calling nanosleep() with the same rqtp and rmtp arguments.

rqtp
A pointer to a timespec structure that specifies the time interval between the requested time and the time actually slept.
rmtp
NULL, or a pointer to a timespec in which the function can store the amount of time remaining in an interval.

For the relative clock_nanosleep() function, if rmtp isn't NULL, the timespec structure referenced by it is updated to contain the amount of time remaining in the interval (the requested time minus the time actually slept). If it's NULL, the remaining time isn't returned.

The absolute clock_nanosleep() function has no effect on the structure referenced by rmtp.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The clock_nanosleep() function suspends the current thread from execution until:

The nanosleep() function always uses CLOCK_REALTIME.

The suspension time may be longer than requested because the argument value is rounded up to an integer multiple of the sleep resolution (see the Tick, Tock: Understanding the Neutrino Microkernel's Concept of Time chapter of the QNX Neutrino Programmer's Guide) or because of scheduling and other system activity. Except for the case of being interrupted by a signal, the suspension time for:

Using the clock_nanosleep() function has no effect on the action or blockage of any signal.

Returns:

Zero if the requested time has elapsed, or a corresponding error value if clock_nanosleep() has been interrupted by a signal, or fails.

Errors:

EINTR
The call was interrupted by a signal.
EINVAL
The rqtp argument specified a nanosecond value less than zero or greater than or equal to 1000 million; or TIMER_ABSTIME is specified in flags and the rqtp argument is outside the range for the clock specified by clock_id; or the clock_id argument doesn't specify a known clock, or specifies the CPU-time clock of the calling thread.
ENOTSUP
The clock_id argument specifies a clock for which clock_nanosleep() isn't supported, such as a CPU-time clock.

Classification:

POSIX 1003.1 CS

Safety:
Cancellation point Yes
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

clock_settime(), nanosleep(), sleep(), timespec

Clocks, Timers, and Getting a Kick Every So Often chapter of Getting Started with QNX Neutrino

Tick, Tock: Understanding the Neutrino Microkernel's Concept of Time chapter of the QNX Neutrino Programmer's Guide


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/c/clock_nanosleep.html on line 278

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/c/clock_nanosleep.html on line 278