chiark / gitweb /
[PATCH] sync with latest version of klibc (0.107)
[elogind.git] / klibc / klibc / sleep.c
1 /*
2  * sleep.c
3  */
4
5 #include <errno.h>
6 #include <time.h>
7
8 unsigned int sleep(unsigned int seconds)
9 {
10   struct timespec ts;
11
12   ts.tv_sec = seconds;
13   ts.tv_nsec = 0;
14   if ( !nanosleep(&ts,&ts) )
15     return 0;
16   else if ( errno == EINTR )
17     return ts.tv_sec;
18   else
19     return -1;
20 }