Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / posix / usleep.c
blobcc1b3140860b64fe611ff86e138b32ac350c18d8
1 /* libc/posix/usleep.c - usleep function */
3 /* Written 2002 by Jeff Johnston */
5 #ifdef HAVE_NANOSLEEP
7 #include <errno.h>
8 #include <time.h>
9 #include <unistd.h>
11 int usleep(useconds_t useconds)
13 struct timespec ts;
15 ts.tv_sec = (long int)useconds / 1000000;
16 ts.tv_nsec = ((long int)useconds % 1000000) * 1000;
17 if (!nanosleep(&ts,&ts)) return 0;
18 return -1;
21 #endif