waiter.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
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
9#include "squid.h"
10
11#if HAVE_ASSERT_H
12#include <assert.h>
13#endif
14
15int
16main(int argc, char *argv[])
17{
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) {
30 to.tv_usec += 1000000;
31 to.tv_sec -= 1;
32 }
33 select(1, NULL, NULL, NULL, &to);
34 return 0;
35}
36
#define assert(EX)
Definition: assert.h:19
static struct timeval now
Definition: tcp-banger2.c:97
#define NULL
Definition: types.h:166
int main(int argc, char *argv[])
Definition: waiter.c:16

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors