Right now there's no way to enforce a specific value of now_ms upon
startup in order to compensate for the time it takes to load a config,
specifically when dealing with the health check startup. For this we'd
need to force the now_offset value to compensate for the last known
value of the current date. This patch exposes a function to do exactly
this.
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)
{
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.
*/