Cache current monotime to avoid unnecessary calls.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
struct interface *ifp;
int remote_cbit = false;
int state = BFD_STATUS_UNKNOWN;
+ time_t now;
size_t addrlen;
struct prefix dp;
struct prefix sp;
break;
}
+ /* Cache current time to avoid multiple monotime clock calls. */
+ now = monotime(NULL);
+
/* Notify all matching sessions about update. */
TAILQ_FOREACH (bsp, &bsglobal.bsplist, entry) {
/* Skip disabled or not installed entries. */
if ((int)bsp->bss.state == state)
continue;
- bsp->bss.last_event = monotime(NULL);
+ bsp->bss.last_event = now;
bsp->bss.previous_state = bsp->bss.state;
bsp->bss.state = state;
bsp->bss.remote_cbit = remote_cbit;