REORG: include: move time.h from common/ to haproxy/
This one is included almost everywhere and used to rely on a few other .h that are not needed (unistd, stdlib, standard.h). It could possibly make sense to split it into multiple parts to distinguish operations performed on timers and the internal time accounting, but at this point it does not appear much important.
This commit is contained in:
parent
af613e8359
commit
92b4f1372e
@ -21,7 +21,7 @@
|
||||
#include <haproxy/api.h>
|
||||
#include <common/standard.h>
|
||||
#include <common/chunk.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
|
||||
#include <proto/spoe.h>
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
|
||||
#include <types/global.h>
|
||||
#include <types/stream.h>
|
||||
|
@ -1,8 +1,8 @@
|
||||
/*
|
||||
* include/common/time.h
|
||||
* include/haproxy/time.h
|
||||
* Time calculation functions and macros.
|
||||
*
|
||||
* Copyright (C) 2000-2011 Willy Tarreau - w@1wt.eu
|
||||
* Copyright (C) 2000-2020 Willy Tarreau - w@1wt.eu
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -19,15 +19,13 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _COMMON_TIME_H
|
||||
#define _COMMON_TIME_H
|
||||
#ifndef _HAPROXY_TIME_H
|
||||
#define _HAPROXY_TIME_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <haproxy/api.h>
|
||||
#include <haproxy/thread.h>
|
||||
#include <common/standard.h>
|
||||
|
||||
/* eternity when exprimed in timeval */
|
||||
#ifndef TV_ETERNITY
|
||||
@ -82,16 +80,6 @@ int tv_ms_cmp(const struct timeval *tv1, const struct timeval *tv2);
|
||||
*/
|
||||
int tv_ms_cmp2(const struct timeval *tv1, const struct timeval *tv2);
|
||||
|
||||
/**** general purpose functions and macros *******************************/
|
||||
|
||||
|
||||
/* tv_now: sets <tv> to the current time */
|
||||
static inline struct timeval *tv_now(struct timeval *tv)
|
||||
{
|
||||
gettimeofday(tv, NULL);
|
||||
return tv;
|
||||
}
|
||||
|
||||
/* tv_udpate_date: sets <date> to system time, and sets <now> to something as
|
||||
* close as possible to real time, following a monotonic function. The main
|
||||
* principle consists in detecting backwards and forwards time jumps and adjust
|
||||
@ -104,6 +92,16 @@ void tv_update_date(int max_wait, int interrupted);
|
||||
|
||||
char *timeofday_as_iso_us(int pad);
|
||||
|
||||
/**** general purpose functions and macros *******************************/
|
||||
|
||||
|
||||
/* tv_now: sets <tv> to the current time */
|
||||
static inline struct timeval *tv_now(struct timeval *tv)
|
||||
{
|
||||
gettimeofday(tv, NULL);
|
||||
return tv;
|
||||
}
|
||||
|
||||
/*
|
||||
* sets a struct timeval to its highest value so that it can never happen
|
||||
* note that only tv_usec is necessary to detect it since a tv_usec > 999999
|
||||
@ -602,7 +600,7 @@ static inline void tv_leaving_poll(int timeout, int interrupted)
|
||||
ti->prev_mono_time = now_mono_time();
|
||||
}
|
||||
|
||||
#endif /* _COMMON_TIME_H */
|
||||
#endif /* _HAPROXY_TIME_H */
|
||||
|
||||
/*
|
||||
* Local variables:
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <haproxy/atomic.h>
|
||||
#include <haproxy/api.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <types/activity.h>
|
||||
#include <proto/freq_ctr.h>
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#define _PROTO_BACKEND_H
|
||||
|
||||
#include <haproxy/api.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
|
||||
#include <types/backend.h>
|
||||
#include <types/proxy.h>
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <common/chunk.h>
|
||||
#include <common/htx.h>
|
||||
#include <common/ticks.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
|
||||
#include <types/channel.h>
|
||||
#include <types/global.h>
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#include <haproxy/api.h>
|
||||
#include <common/ticks.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <types/fd.h>
|
||||
#include <proto/activity.h>
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <haproxy/atomic.h>
|
||||
#include <haproxy/api.h>
|
||||
#include <common/standard.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <types/freq_ctr.h>
|
||||
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <haproxy/api.h>
|
||||
#include <common/ticks.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <proto/connection.h>
|
||||
#include <types/stream.h>
|
||||
#include <types/peers.h>
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <haproxy/api.h>
|
||||
#include <common/ticks.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <types/applet.h>
|
||||
#include <types/global.h>
|
||||
#include <types/proxy.h>
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include <haproxy/api.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <types/applet.h>
|
||||
#include <types/dns.h>
|
||||
#include <types/proxy.h>
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#include <haproxy/errors.h>
|
||||
#include <common/ticks.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <types/stick_table.h>
|
||||
#include <types/dict.h>
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include <haproxy/hash.h>
|
||||
#include <common/htx.h>
|
||||
#include <common/ticks.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <common/namespace.h>
|
||||
|
||||
#include <types/global.h>
|
||||
|
@ -48,7 +48,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <haproxy/api.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
|
||||
static FILE *log;
|
||||
static int level;
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include <haproxy/errors.h>
|
||||
#include <common/memory.h>
|
||||
#include <common/standard.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <common/uri_auth.h>
|
||||
#include <common/namespace.h>
|
||||
#include <haproxy/thread.h>
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include <common/chunk.h>
|
||||
#include <haproxy/list.h>
|
||||
#include <common/standard.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <haproxy/thread.h>
|
||||
#include <common/http.h>
|
||||
#include <common/h1.h>
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include <haproxy/list.h>
|
||||
#include <common/standard.h>
|
||||
#include <common/ticks.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <common/uri_auth.h>
|
||||
#include <haproxy/version.h>
|
||||
#include <haproxy/base64.h>
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <haproxy/api.h>
|
||||
#include <common/cfgparse.h>
|
||||
#include <haproxy/errors.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <common/ticks.h>
|
||||
#include <common/net_helper.h>
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <haproxy/thread-t.h>
|
||||
#include <common/standard.h>
|
||||
#include <common/ticks.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
|
||||
#include <types/global.h>
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <haproxy/api.h>
|
||||
#include <haproxy/thread-t.h>
|
||||
#include <common/ticks.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
|
||||
#include <types/global.h>
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <haproxy/api.h>
|
||||
#include <haproxy/thread-t.h>
|
||||
#include <common/ticks.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
|
||||
#include <types/global.h>
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <haproxy/api.h>
|
||||
#include <haproxy/thread-t.h>
|
||||
#include <common/ticks.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
|
||||
#include <types/global.h>
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <haproxy/api.h>
|
||||
#include <haproxy/thread-t.h>
|
||||
#include <common/ticks.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
|
||||
#include <types/global.h>
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <common/cfgparse.h>
|
||||
#include <haproxy/thread.h>
|
||||
#include <common/memory.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
|
||||
#include <types/arg.h>
|
||||
#include <types/global.h>
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include <haproxy/api.h>
|
||||
#include <common/htx.h>
|
||||
#include <common/standard.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
|
||||
#include <types/channel.h>
|
||||
#include <types/filters.h>
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#include <haproxy/api.h>
|
||||
#include <common/standard.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <proto/freq_ctr.h>
|
||||
|
||||
/* Read a frequency counter taking history into account for missing time in
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <haproxy/api.h>
|
||||
#include <common/chunk.h>
|
||||
#include <common/standard.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
|
||||
#include <types/global.h>
|
||||
|
||||
|
@ -92,7 +92,7 @@
|
||||
#include <haproxy/openssl-compat.h>
|
||||
#include <common/regex.h>
|
||||
#include <common/standard.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <common/uri_auth.h>
|
||||
#include <haproxy/version.h>
|
||||
#include <haproxy/thread.h>
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <lualib.h>
|
||||
|
||||
#include <common/net_helper.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <common/uri_auth.h>
|
||||
|
||||
#include <types/cli.h>
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <haproxy/errors.h>
|
||||
#include <haproxy/list.h>
|
||||
#include <common/standard.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
|
||||
#include <types/global.h>
|
||||
#include <types/protocol.h>
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#include <haproxy/api.h>
|
||||
#include <common/standard.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <haproxy/version.h>
|
||||
|
||||
#include <types/cli.h>
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include <haproxy/api.h>
|
||||
#include <common/net_helper.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <common/standard.h>
|
||||
#include <haproxy/thread.h>
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <haproxy/errors.h>
|
||||
#include <haproxy/list.h>
|
||||
#include <common/standard.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <haproxy/version.h>
|
||||
|
||||
#include <types/global.h>
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <haproxy/errors.h>
|
||||
#include <haproxy/list.h>
|
||||
#include <common/standard.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <haproxy/version.h>
|
||||
|
||||
#include <types/global.h>
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <common/cfgparse.h>
|
||||
#include <haproxy/errors.h>
|
||||
#include <common/memory.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
|
||||
#include <import/eb32tree.h>
|
||||
#include <import/ebistree.h>
|
||||
|
@ -71,7 +71,7 @@
|
||||
|
||||
#include <haproxy/api.h>
|
||||
#include <common/memory.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <haproxy/thread.h>
|
||||
#include <import/eb32tree.h>
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <common/buffer.h>
|
||||
#include <common/standard.h>
|
||||
#include <common/ticks.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
|
||||
#include <proto/connection.h>
|
||||
#include <proto/fd.h>
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <common/cfgparse.h>
|
||||
#include <haproxy/errors.h>
|
||||
#include <common/namespace.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
|
||||
#include <types/applet.h>
|
||||
#include <types/cli.h>
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <common/cfgparse.h>
|
||||
#include <import/ist.h>
|
||||
#include <haproxy/list.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <proto/cli.h>
|
||||
#include <proto/log.h>
|
||||
#include <proto/ring.h>
|
||||
|
@ -50,7 +50,7 @@
|
||||
#include <haproxy/openssl-compat.h>
|
||||
#include <common/standard.h>
|
||||
#include <common/ticks.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <haproxy/base64.h>
|
||||
|
||||
#include <import/ebpttree.h>
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include <haproxy/list.h>
|
||||
#include <common/standard.h>
|
||||
#include <common/ticks.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <common/uri_auth.h>
|
||||
#include <haproxy/version.h>
|
||||
#include <haproxy/base64.h>
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <haproxy/list.h>
|
||||
#include <common/net_helper.h>
|
||||
#include <common/standard.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
|
||||
#include <import/ebmbtree.h>
|
||||
#include <import/ebsttree.h>
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <common/buffer.h>
|
||||
#include <common/standard.h>
|
||||
#include <common/ticks.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
|
||||
#include <proto/applet.h>
|
||||
#include <proto/channel.h>
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <common/memory.h>
|
||||
#include <haproxy/list.h>
|
||||
#include <common/standard.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <import/eb32sctree.h>
|
||||
#include <import/eb32tree.h>
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <haproxy/list.h>
|
||||
#include <common/standard.h>
|
||||
#include <common/ticks.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
|
||||
#include <types/arg.h>
|
||||
#include <types/capture.h>
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include <haproxy/api.h>
|
||||
#include <common/standard.h>
|
||||
#include <common/time.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <haproxy/thread-t.h>
|
||||
|
||||
THREAD_LOCAL unsigned int ms_left_scaled; /* milliseconds left for current second (0..2^32-1) */
|
||||
|
Loading…
x
Reference in New Issue
Block a user