Go to the documentation of this file.
35 #define INTERVAL_DEBUG 0
69 const time_t local_now =
now;
96 const time_t local_now =
now;
100 dmsg(
D_INTERVAL,
"INTERVAL interval_schedule wakeup=%d", (
int)*wakeup);
113 dmsg(
D_INTERVAL,
"INTERVAL interval_future_trigger %d", (
int)wakeup);
177 et->
n = (n >= 0) ? n : 0;
210 et->
n = (n >= 0) ? n : 0;
224 #define ETT_DEFAULT (-1)
266 #define USEC_TIMER_MAX 60
268 #define USEC_TIMER_MAX_USEC (USEC_TIMER_MAX * 1000000)
275 #ifdef HAVE_GETTIMEOFDAY
295 return obj->
start.tv_sec && obj->
end.tv_sec;
static void interval_action(struct interval *top)
static int tv_subtract(const struct timeval *tv1, const struct timeval *tv2, const unsigned int max_seconds)
void interval_init(struct interval *top, int horizon, int refresh)
static void interval_schedule_wakeup(struct interval *top, interval_t *wakeup)
static void interval_earliest_wakeup(interval_t *wakeup, time_t at, time_t current)
static void event_timeout_init(struct event_timeout *et, interval_t n, const time_t last)
Initialises a timer struct.
static void usec_timer_start(struct usec_timer *obj)
static void event_timeout_modify_wakeup(struct event_timeout *et, interval_t n)
Sets the interval n of a timeout.
bool event_timeout_trigger(struct event_timeout *et, struct timeval *tv, int et_const_retry)
This is the principal function for testing and triggering recurring timers.
static void usec_timer_end(struct usec_timer *obj)
bool defined
This timeout is active.
interval_t n
periodic interval for periodic timeouts
static bool interval_test(struct interval *top)
static bool usec_timer_interval_defined(struct usec_timer *obj)
static int usec_timer_interval(struct usec_timer *obj)
static int openvpn_gettimeofday(struct timeval *tv, void *tz)
static bool event_timeout_defined(const struct event_timeout *et)
static void event_timeout_clear(struct event_timeout *et)
Clears the timeout and reset all values to 0.
time_t last
time of last event
static void interval_future_trigger(struct interval *top, interval_t wakeup)
static void event_timeout_reset(struct event_timeout *et)
Resets a timer.
static interval_t event_timeout_remaining(struct event_timeout *et)
Returns the time until the timeout should triggered, from now.