From: wessels <> Date: Thu, 17 Sep 1998 00:20:35 +0000 (+0000) Subject: adding X-Git-Tag: SQUID_3_0_PRE1~2703 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=01922c69b1e1bc0bd3882a87fd7b307d15f60b54;p=thirdparty%2Fsquid.git adding --- diff --git a/test-suite/waiter.c b/test-suite/waiter.c new file mode 100644 index 0000000000..d86637f8ea --- /dev/null +++ b/test-suite/waiter.c @@ -0,0 +1,24 @@ +#include +#include + +int +main(int argc, char *argv[]) +{ + int i; + struct timeval now; + struct timeval alarm; + struct timeval to; + assert(argc == 2); + i = atoi(argv[1]); + gettimeofday(&now, NULL); + alarm.tv_sec = now.tv_sec + i + (now.tv_sec % i); + alarm.tv_usec = 0; + to.tv_sec = alarm.tv_sec - now.tv_sec; + to.tv_usec = alarm.tv_usec - now.tv_usec; + if (to.tv_usec < 0) { + to.tv_usec += 1000000; + to.tv_sec -= 1; + } + select(1, NULL, NULL, NULL, &to); + return 0; +}