Annotation of /trunk/mkinitrd-magellan/klibc/usr/klibc/sleep.c
Parent Directory | Revision Log
Revision 815 -
(hide 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)
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 | niro | 532 | /* |
2 | * sleep.c | ||
3 | */ | ||
4 | |||
5 | #include <errno.h> | ||
6 | niro | 815 | #include <stdlib.h> |
7 | niro | 532 | #include <time.h> |
8 | niro | 815 | #include <unistd.h> |
9 | niro | 532 | |
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 | } |