blob: 32e134117fe84e37ec17224d5be4f5c90f6dc36f [file] [log] [blame]
#define _GNU_SOURCE
#include <sys/time.h>
#include <unistd.h>
unsigned ualarm(unsigned value, unsigned interval) {
struct itimerval it = {
.it_interval.tv_usec = interval,
.it_value.tv_usec = value,
};
struct itimerval old = {};
setitimer(ITIMER_REAL, &it, &old);
return old.it_value.tv_sec * 1000000 + old.it_value.tv_usec;
}