mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 22:31:28 +02:00
MINOR: clock: add clock_set_now_offset() helper
Since now_offset is a static variable and is not exposed outside from clock.c, let's add an helper so that it becomes possible to set its value from another source file.
This commit is contained in:
parent
4c3a36c609
commit
20f9d8fa4e
@ -49,6 +49,7 @@ uint clock_report_idle(void);
|
|||||||
void clock_leaving_poll(int timeout, int interrupted);
|
void clock_leaving_poll(int timeout, int interrupted);
|
||||||
void clock_entering_poll(void);
|
void clock_entering_poll(void);
|
||||||
void clock_adjust_now_offset(void);
|
void clock_adjust_now_offset(void);
|
||||||
|
void clock_set_now_offset(llong ofs);
|
||||||
|
|
||||||
static inline void clock_update_date(int max_wait, int interrupted)
|
static inline void clock_update_date(int max_wait, int interrupted)
|
||||||
{
|
{
|
||||||
|
@ -364,6 +364,11 @@ void clock_adjust_now_offset(void)
|
|||||||
HA_ATOMIC_STORE(&now_offset, now_ns - tv_to_ns(&date));
|
HA_ATOMIC_STORE(&now_offset, now_ns - tv_to_ns(&date));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clock_set_now_offset(llong ofs)
|
||||||
|
{
|
||||||
|
HA_ATOMIC_STORE(&now_offset, ofs);
|
||||||
|
}
|
||||||
|
|
||||||
/* must be called once per thread to initialize their thread-local variables.
|
/* must be called once per thread to initialize their thread-local variables.
|
||||||
* Note that other threads might also be initializing and running in parallel.
|
* Note that other threads might also be initializing and running in parallel.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user