2 ** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the Haiku License.
11 #include <errno_private.h>
16 alarm(unsigned int sec
)
18 struct itimerval value
, oldValue
;
20 value
.it_interval
.tv_sec
= value
.it_interval
.tv_usec
= 0;
21 value
.it_value
.tv_sec
= sec
;
22 value
.it_value
.tv_usec
= 0;
23 if (setitimer(ITIMER_REAL
, &value
, &oldValue
) < 0)
26 if (oldValue
.it_value
.tv_usec
)
27 oldValue
.it_value
.tv_sec
++;
29 return oldValue
.it_value
.tv_sec
;