MINOR: clock: add clock_get_now_offset() helper

Same as clock_set_now_offset() but to retrieve the offset from external
location.
This commit is contained in:
Aurelien DARRAGON 2025-08-07 15:28:59 +02:00
parent 20f9d8fa4e
commit c8282f6138
2 changed files with 6 additions and 0 deletions

View 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)
{

View 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.
*/