OSDN Git Service

Last portion of libc_hidden_proto removal.
[uclinux-h8/uClibc.git] / libc / unistd / ualarm.c
1 /*
2  * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
3  *
4  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
5  */
6
7 #include <time.h>
8 #include <sys/time.h>
9 #include <sys/types.h>
10 #include <unistd.h>
11
12 /* libc_hidden_proto(setitimer) */
13
14 useconds_t ualarm(useconds_t value, useconds_t interval)
15 {
16     struct itimerval otimer;
17     const struct itimerval itimer = {
18         { 0, interval },
19         { 0, value}
20     };
21
22     if (setitimer(ITIMER_REAL, &itimer, &otimer) < 0) {
23         return -1;
24     }
25     return((otimer.it_value.tv_sec * 1000000) + otimer.it_value.tv_usec);
26 }