Magellan Linux

Contents of /trunk/mkinitrd-magellan/klibc/usr/klibc/sleep.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 815 - (show annotations) (download)
Fri Apr 24 18:32:46 2009 UTC (15 years ago) by niro
File MIME type: text/plain
File size: 307 byte(s)
-updated to klibc-1.5.15
1 /*
2 * sleep.c
3 */
4
5 #include <errno.h>
6 #include <stdlib.h>
7 #include <time.h>
8 #include <unistd.h>
9
10 unsigned int sleep(unsigned int seconds)
11 {
12 struct timespec ts;
13
14 ts.tv_sec = seconds;
15 ts.tv_nsec = 0;
16 if (!nanosleep(&ts, &ts))
17 return 0;
18 else if (errno == EINTR)
19 return ts.tv_sec;
20 else
21 return -1;
22 }