source: trunk/libs/newlib/src/newlib/libc/sys/linux/sleep.c

Last change on this file was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 391 bytes
Line 
1/* libc/sys/linux/sleep.c - sleep function */
2
3/* Written 2000 by Werner Almesberger */
4
5
6#include <errno.h>
7#include <sys/types.h>
8#include <sys/time.h>
9#include <linux/times.h>
10
11unsigned int sleep(unsigned int seconds)
12{
13    struct timespec ts;
14
15    ts.tv_sec = seconds;
16    ts.tv_nsec = 0;
17    if (!nanosleep(&ts,&ts)) return 0;
18    if (errno == EINTR) return ts.tv_sec;
19    return -1;
20}
Note: See TracBrowser for help on using the repository browser.