From 01922c69b1e1bc0bd3882a87fd7b307d15f60b54 Mon Sep 17 00:00:00 2001 From: wessels <> Date: Thu, 17 Sep 1998 00:20:35 +0000 Subject: [PATCH] adding --- test-suite/waiter.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 test-suite/waiter.c 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; +} -- 2.47.3