mirror of
https://gitlab.labs.nic.cz/labs/bird.git
synced 2024-05-11 16:54:54 +00:00
Implements generalized import hooks.
Thanks to Alexander V. Chernikov for the original patch.
This commit is contained in:
@@ -30,6 +30,22 @@ void tm_start(timer *, unsigned after);
|
||||
void tm_stop(timer *);
|
||||
void tm_dump_all(void);
|
||||
|
||||
extern bird_clock_t now; /* Relative, monotonic time in seconds */
|
||||
extern bird_clock_t now_real; /* Time in seconds since fixed known epoch */
|
||||
|
||||
static inline bird_clock_t
|
||||
tm_remains(timer *t)
|
||||
{
|
||||
return t->expires ? t->expires - now : 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
tm_start_max(timer *t, unsigned after)
|
||||
{
|
||||
bird_clock_t rem = tm_remains(t);
|
||||
tm_start(t, (rem > after) ? rem : after);
|
||||
}
|
||||
|
||||
static inline timer *
|
||||
tm_new_set(pool *p, void (*hook)(struct timer *), void *data, unsigned rand, unsigned rec)
|
||||
{
|
||||
@@ -41,8 +57,6 @@ tm_new_set(pool *p, void (*hook)(struct timer *), void *data, unsigned rand, uns
|
||||
return t;
|
||||
}
|
||||
|
||||
extern bird_clock_t now; /* Relative, monotonic time in seconds */
|
||||
extern bird_clock_t now_real; /* Time in seconds since fixed known epoch */
|
||||
|
||||
struct timeformat {
|
||||
char *fmt1, *fmt2;
|
||||
|
Reference in New Issue
Block a user