1 /* sleep() - Sleep for a number of seconds. Author: Erik van der Kouwe
3 * (Avoids interfering with alarm/setitimer by using select, like usleep)
11 #include <sys/select.h>
14 unsigned sleep(unsigned sleep_seconds
)
16 struct timespec rqtp
, rmtp
;
18 /* nanosleep implements this call; ignore failure, it cannot be reported */
19 rqtp
.tv_sec
= sleep_seconds
;
21 nanosleep(&rqtp
, &rmtp
);
23 /* round remainder up to seconds */
24 return rmtp
.tv_sec
+ ((rmtp
.tv_nsec
> 0) ? 1 : 0);