]> git.ipfire.org Git - thirdparty/squid.git/blob - test-suite/waiter.c
Renamed squid.h to squid-old.h and config.h to squid.h
[thirdparty/squid.git] / test-suite / waiter.c
1 #include "squid.h"
2
3 #if HAVE_ASSERT_H
4 #include <assert.h>
5 #endif
6
7 int
8 main(int argc, char *argv[])
9 {
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) {
22 to.tv_usec += 1000000;
23 to.tv_sec -= 1;
24 }
25 select(1, NULL, NULL, NULL, &to);
26 return 0;
27 }