]> git.ipfire.org Git - thirdparty/squid.git/blame - test-suite/waiter.c
adding
[thirdparty/squid.git] / test-suite / waiter.c
CommitLineData
01922c69 1#include <sys/time.h>
2#include <assert.h>
3
4int
5main(int argc, char *argv[])
6{
7 int i;
8 struct timeval now;
9 struct timeval alarm;
10 struct timeval to;
11 assert(argc == 2);
12 i = atoi(argv[1]);
13 gettimeofday(&now, NULL);
14 alarm.tv_sec = now.tv_sec + i + (now.tv_sec % i);
15 alarm.tv_usec = 0;
16 to.tv_sec = alarm.tv_sec - now.tv_sec;
17 to.tv_usec = alarm.tv_usec - now.tv_usec;
18 if (to.tv_usec < 0) {
19 to.tv_usec += 1000000;
20 to.tv_sec -= 1;
21 }
22 select(1, NULL, NULL, NULL, &to);
23 return 0;
24}