OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [newlib/] [libc/] [posix/] [sleep.c] - Blame information for rev 868

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/* libc/posix/sleep.c - sleep function */
2
 
3
/* Written 2000 by Werner Almesberger */
4
 
5
#ifdef HAVE_NANOSLEEP
6
 
7
#include <errno.h>
8
#include <time.h>
9
#include <unistd.h>
10
 
11
unsigned sleep(unsigned 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
}
21
 
22
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.