OLD | NEW |
1 #define _GNU_SOURCE | 1 #define _GNU_SOURCE |
2 #include <unistd.h> | 2 #include <unistd.h> |
3 #include <sys/time.h> | 3 #include <sys/time.h> |
4 | 4 |
5 unsigned ualarm(unsigned value, unsigned interval) | 5 unsigned ualarm(unsigned value, unsigned interval) { |
6 { | 6 struct itimerval it = {.it_interval.tv_usec = interval, |
7 » struct itimerval it = { | 7 .it_value.tv_usec = value}; |
8 » » .it_interval.tv_usec = interval, | 8 setitimer(ITIMER_REAL, &it, &it); |
9 » » .it_value.tv_usec = value | 9 return it.it_value.tv_sec * 1000000 + it.it_value.tv_usec; |
10 » }; | |
11 » setitimer(ITIMER_REAL, &it, &it); | |
12 » return it.it_value.tv_sec*1000000 + it.it_value.tv_usec; | |
13 } | 10 } |
OLD | NEW |