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.
(cherry picked from commit 650f374f24c4dd14e90d336c72c2370242be1459)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit f520788e171f3393347da00358ae4ca2f30789a2)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 8ff0c907c7f9edc3f778b51e6980b1cd0bcff5e6)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit ffd80fd42208681731d9fd53fcf8741139896638)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/include/common/time.h b/include/common/time.h
index 2633b1c..0feb0b6 100644
--- a/include/common/time.h
+++ b/include/common/time.h
@@ -63,6 +63,7 @@
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 e830f85..f5c5358 100644
--- a/src/time.c
+++ b/src/time.c
@@ -30,7 +30,7 @@
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) */
/*
* adds <ms> ms to <from>, set the result to <tv> and returns a pointer <tv>