xref: /third_party/musl/src/unistd/ualarm.c
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/musl/src/unistd/
1570af302Sopenharmony_ci#define _GNU_SOURCE
2570af302Sopenharmony_ci#include <unistd.h>
3570af302Sopenharmony_ci#include <sys/time.h>
4570af302Sopenharmony_ci
5570af302Sopenharmony_ciunsigned ualarm(unsigned value, unsigned interval)
6570af302Sopenharmony_ci{
7570af302Sopenharmony_ci	struct itimerval it = {
8570af302Sopenharmony_ci		.it_interval.tv_usec = interval,
9570af302Sopenharmony_ci		.it_value.tv_usec = value
10570af302Sopenharmony_ci	}, it_old;
11570af302Sopenharmony_ci	setitimer(ITIMER_REAL, &it, &it_old);
12570af302Sopenharmony_ci	return it_old.it_value.tv_sec*1000000 + it_old.it_value.tv_usec;
13570af302Sopenharmony_ci}
14

Indexes created Thu Nov 07 10:32:03 CST 2024