alarm.c\unistd\src - musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/src/unistd/alarm.c
blob: a5e0c822a05559ffaa2023ab8b6fca3d20f1af63 (plain) (blame)
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 }, old = { 0 };
	setitimer(ITIMER_REAL, &it, &old);
	return old.it_value.tv_sec + !!old.it_value.tv_usec;
}
generated by cgit v1.2.1 (git 2.18.0) at 2025年09月06日 04:06:40 +0000

AltStyle によって変換されたページ (->オリジナル) /