Last change
on this file since 444 was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
431 bytes
|
Rev | Line | |
---|
[444] | 1 | /* Copied from libc/posix/usleep.c, removed the check for HAVE_NANOSLEEP */ |
---|
| 2 | |
---|
| 3 | /* Written 2002 by Jeff Johnston */ |
---|
| 4 | |
---|
| 5 | #include <errno.h> |
---|
| 6 | #include <time.h> |
---|
| 7 | #include <unistd.h> |
---|
| 8 | |
---|
| 9 | int usleep(useconds_t useconds) |
---|
| 10 | { |
---|
| 11 | struct timespec ts; |
---|
| 12 | |
---|
| 13 | ts.tv_sec = (long int)useconds / 1000000; |
---|
| 14 | ts.tv_nsec = ((long int)useconds % 1000000) * 1000; |
---|
| 15 | if (!nanosleep(&ts,&ts)) return 0; |
---|
| 16 | if (errno == EINTR) return ts.tv_sec; |
---|
| 17 | return -1; |
---|
| 18 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.