]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: clock: add clock_get_now_offset() helper
authorAurelien DARRAGON <adarragon@haproxy.com>
Thu, 7 Aug 2025 13:28:59 +0000 (15:28 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Thu, 7 Aug 2025 20:27:09 +0000 (22:27 +0200)
Same as clock_set_now_offset() but to retrieve the offset from external
location.

include/haproxy/clock.h
src/clock.c

index 3737fc51e0fa39d5946fe00643e133f7fe861e44..082ab13443fb522362fb9ac31c46ca2095aa3c05 100644 (file)
@@ -50,6 +50,7 @@ void clock_leaving_poll(int timeout, int interrupted);
 void clock_entering_poll(void);
 void clock_adjust_now_offset(void);
 void clock_set_now_offset(llong ofs);
+llong clock_get_now_offset(void);
 
 static inline void clock_update_date(int max_wait, int interrupted)
 {
index 6fba12a1c154e986008e2b491bf71a0b10e0ca55..6dbbd0ff9575068a30f23620b56eb75e2a2afb87 100644 (file)
@@ -369,6 +369,11 @@ void clock_set_now_offset(llong ofs)
        HA_ATOMIC_STORE(&now_offset, ofs);
 }
 
+llong clock_get_now_offset(void)
+{
+       return HA_ATOMIC_LOAD(&now_offset);
+}
+
 /* must be called once per thread to initialize their thread-local variables.
  * Note that other threads might also be initializing and running in parallel.
  */