diff --git a/include/haproxy/clock.h b/include/haproxy/clock.h index 8ce41e79e..264363e27 100644 --- a/include/haproxy/clock.h +++ b/include/haproxy/clock.h @@ -48,6 +48,7 @@ char *timeofday_as_iso_us(int pad); uint clock_report_idle(void); void clock_leaving_poll(int timeout, int interrupted); void clock_entering_poll(void); +void clock_adjust_now_offset(void); static inline void clock_update_date(int max_wait, int interrupted) { diff --git a/src/clock.c b/src/clock.c index 7cf71607f..ec2133c8b 100644 --- a/src/clock.c +++ b/src/clock.c @@ -304,6 +304,11 @@ void clock_init_process_date(void) clock_update_date(0, 1); } +void clock_adjust_now_offset(void) +{ + HA_ATOMIC_STORE(&now_offset, now_ns - tv_to_ns(&date)); +} + /* must be called once per thread to initialize their thread-local variables. * Note that other threads might also be initializing and running in parallel. */