Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / posix / sleep.c
blob0d6cd710ded80381001f35a28301e6a0d591885e
1 /* libc/posix/sleep.c - sleep function */
3 /* Written 2000 by Werner Almesberger */
5 #ifdef HAVE_NANOSLEEP
7 #include <errno.h>
8 #include <time.h>
9 #include <unistd.h>
10 #include <limits.h>
12 unsigned sleep(unsigned seconds)
14 struct timespec ts;
16 ts.tv_sec = seconds;
17 ts.tv_nsec = 0;
18 if (!nanosleep(&ts,&ts)) return 0;
19 if (errno == EINTR) return ts.tv_sec & UINT_MAX;
20 return -1;
23 #endif