You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

13 lines
323 B

#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
}, it_old;
setitimer(ITIMER_REAL, &it, &it_old);
return it_old.it_value.tv_sec*1000000 + it_old.it_value.tv_usec;
}