]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
adding
authorwessels <>
Thu, 17 Sep 1998 00:20:35 +0000 (00:20 +0000)
committerwessels <>
Thu, 17 Sep 1998 00:20:35 +0000 (00:20 +0000)
test-suite/waiter.c [new file with mode: 0644]

diff --git a/test-suite/waiter.c b/test-suite/waiter.c
new file mode 100644 (file)
index 0000000..d86637f
--- /dev/null
@@ -0,0 +1,24 @@
+#include <sys/time.h>
+#include <assert.h>
+
+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;
+}