From: Willy Tarreau Date: Wed, 17 Mar 2021 17:52:18 +0000 (+0100) Subject: MINOR: time: export the global_now variable X-Git-Tag: v2.4-dev13~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=650f374f24c4dd14e90d336c72c2370242be1459;p=thirdparty%2Fhaproxy.git MINOR: time: export the global_now variable This is the process-wide monotonic time that is used to update each thread's own time. It may be required at a few places where a strictly monotonic clock is required such as freq_ctr. It will be have to be backported as a dependency of a forthcoming fix. --- diff --git a/include/haproxy/time.h b/include/haproxy/time.h index 0fba2cc433..87bc3655a4 100644 --- a/include/haproxy/time.h +++ b/include/haproxy/time.h @@ -60,6 +60,7 @@ extern THREAD_LOCAL struct timeval date; /* the real current date */ extern struct timeval start_date; /* the process's start date */ extern THREAD_LOCAL struct timeval before_poll; /* system date before calling poll() */ extern THREAD_LOCAL struct timeval after_poll; /* system date after leaving poll() */ +extern volatile unsigned long long global_now; /**** exported functions *************************************************/ diff --git a/src/time.c b/src/time.c index a665a85b19..d5344d26f6 100644 --- a/src/time.c +++ b/src/time.c @@ -28,7 +28,7 @@ THREAD_LOCAL struct timeval before_poll; /* system date before calling poll( THREAD_LOCAL struct timeval after_poll; /* system date after leaving poll() */ static THREAD_LOCAL struct timeval tv_offset; /* per-thread time ofsset relative to global time */ -static volatile unsigned long long global_now; /* common date between all threads (32:32) */ +volatile unsigned long long global_now; /* common date between all threads (32:32) */ static THREAD_LOCAL unsigned int iso_time_sec; /* last iso time value for this thread */ static THREAD_LOCAL char iso_time_str[34]; /* ISO time representation of gettimeofday() */