]>
Commit | Line | Data |
---|---|---|
ef364f64 AJ |
1 | #include "config.h" |
2 | ||
3 | #if HAVE_ASSERT_H | |
01922c69 | 4 | #include <assert.h> |
ef364f64 | 5 | #endif |
01922c69 | 6 | |
7 | int | |
8 | main(int argc, char *argv[]) | |
9 | { | |
468ae12b | 10 | int i; |
11 | struct timeval now; | |
12 | struct timeval alarm; | |
13 | struct timeval to; | |
14 | assert(argc == 2); | |
15 | i = atoi(argv[1]); | |
16 | gettimeofday(&now, NULL); | |
17 | alarm.tv_sec = now.tv_sec + i + (now.tv_sec % i); | |
18 | alarm.tv_usec = 0; | |
19 | to.tv_sec = alarm.tv_sec - now.tv_sec; | |
20 | to.tv_usec = alarm.tv_usec - now.tv_usec; | |
21 | if (to.tv_usec < 0) { | |
26ac0430 AJ |
22 | to.tv_usec += 1000000; |
23 | to.tv_sec -= 1; | |
468ae12b | 24 | } |
25 | select(1, NULL, NULL, NULL, &to); | |
26 | return 0; | |
01922c69 | 27 | } |