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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [machine/] [spu/] [usleep.c] - Blame information for rev 407

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

Line No. Rev Author Line
1 148 jeremybenn
/* 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
}

powered by: WebSVN 2.1.0

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