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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libc/] [sys/] [linux/] [time.c] - Blame information for rev 1773

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

Line No. Rev Author Line
1 1010 ivang
/* libc/sys/linux/time.c - Time-related system calls */
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
#include <sys/syscall.h>
11
 
12
 
13
_syscall1(time_t,time,time_t *,t)
14
_syscall1(clock_t,times,struct tms *,buf)
15
_syscall2(int,gettimeofday,struct timeval *,tv,struct timezone *,tz)
16
_syscall2(int,nanosleep,const struct timespec *,req,struct timespec *,rem)
17
 
18
 
19
unsigned int sleep(unsigned int seconds)
20
{
21
    struct timespec ts;
22
 
23
    ts.tv_sec = seconds;
24
    ts.tv_nsec = 0;
25
    if (!nanosleep(&ts,&ts)) return 0;
26
    if (errno == EINTR) return ts.tv_sec;
27
    return -1;
28
}

powered by: WebSVN 2.1.0

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