]> git.ipfire.org Git - thirdparty/squid.git/blame - test-suite/waiter.c
Source Format Enforcement (#532)
[thirdparty/squid.git] / test-suite / waiter.c
CommitLineData
4e0938ef 1/*
77b1029d 2 * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
4e0938ef
AJ
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
f7f3304a 9#include "squid.h"
ef364f64
AJ
10
11#if HAVE_ASSERT_H
01922c69 12#include <assert.h>
ef364f64 13#endif
01922c69 14
15int
16main(int argc, char *argv[])
17{
468ae12b 18 int i;
19 struct timeval now;
20 struct timeval alarm;
21 struct timeval to;
22 assert(argc == 2);
23 i = atoi(argv[1]);
24 gettimeofday(&now, NULL);
25 alarm.tv_sec = now.tv_sec + i + (now.tv_sec % i);
26 alarm.tv_usec = 0;
27 to.tv_sec = alarm.tv_sec - now.tv_sec;
28 to.tv_usec = alarm.tv_usec - now.tv_usec;
29 if (to.tv_usec < 0) {
26ac0430
AJ
30 to.tv_usec += 1000000;
31 to.tv_sec -= 1;
468ae12b 32 }
33 select(1, NULL, NULL, NULL, &to);
34 return 0;
01922c69 35}
f53969cc 36