Causes the current thread to be suspended from execution for the specified interval.
#include <time.h> int nanosleep ( const struct timespec *rqtp, struct timespec *rmtp );
(IN) Points to the interval that the thread should sleep.
(OUT) Points to the time remaining in the interval when a signal interrupts nanosleep.
If nanosleep returns because the interval has expired, it returns 0.
If nanosleep returns because of a signal interrupt, it returns -1 and sets errno. If the rmtp parameter is non-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 the rmtp parameter is NULL, the remaining time is not returned.
If nanosleep fails, it returns -1 and sets errno.
Unless interrupted by an interrupt, nanosleep suspends the thread for at least the specified interval. The interval might be longer than the specified interval, depending upon what else the system is scheduling.