summaryrefslogtreecommitdiff
path: root/src/unistd/alarm.c
blob: 2e3263ac5986019f57576f6b0777f483b449eba7 (plain)
1
2
3
4
5
6
7
8
9
10
#include <unistd.h>
#include <sys/time.h>
#include "syscall.h"

unsigned alarm(unsigned seconds)
{
	struct itimerval it = { .it_value.tv_sec = seconds };
	__syscall(SYS_setitimer, ITIMER_REAL, &it, &it);
	return it.it_value.tv_sec + !!it.it_value.tv_usec;
}