1
0
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:
Ondrej Zajicek
2012-04-15 15:28:29 +02:00
parent ae8b300164
commit ebecb6f6a1
13 changed files with 328 additions and 72 deletions

View File

@@ -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;