mirror of
https://github.com/fluencelabs/musl
synced 2025-07-03 08:32:05 +00:00
14 lines
303 B
C
14 lines
303 B
C
#define _GNU_SOURCE
|
|
#include <unistd.h>
|
|
#include <sys/time.h>
|
|
|
|
unsigned ualarm(unsigned value, unsigned interval)
|
|
{
|
|
struct itimerval it = {
|
|
.it_interval.tv_usec = interval,
|
|
.it_value.tv_usec = value
|
|
};
|
|
setitimer(ITIMER_REAL, &it, &it);
|
|
return it.it_value.tv_sec*1000000 + it.it_value.tv_usec;
|
|
}
|