From d9f3b69e7c20b7ff92b769fd9839ec8701f839d8 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 3 Mar 2015 15:34:07 -0800 Subject: [PATCH] lldp: Use OVS time functions. Signed-off-by: Ben Pfaff --- lib/lldp/lldpd-structs.c | 5 +++-- lib/lldp/lldpd.c | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/lldp/lldpd-structs.c b/lib/lldp/lldpd-structs.c index 7a434ff25..4e3c2b7d7 100644 --- a/lib/lldp/lldpd-structs.c +++ b/lib/lldp/lldpd-structs.c @@ -1,5 +1,6 @@ /* -*- mode: c; c-file-style: "openbsd" -*- */ /* + * Copyright (c) 2015 Nicira, Inc. * Copyright (c) 2008 Vincent Bernat * * Permission to use, copy, modify, and/or distribute this software for any @@ -18,9 +19,9 @@ #include #include "lldpd-structs.h" #include -#include #include #include "lldpd.h" +#include "timeval.h" VLOG_DEFINE_THIS_MODULE(lldpd_structs); @@ -69,7 +70,7 @@ lldpd_remote_cleanup(struct lldpd_hardware *hw, { struct lldpd_port *port, *port_next; int del; - time_t now = time(NULL); + time_t now = time_now(); VLOG_DBG("cleanup remote port on %s", hw->h_ifname); LIST_FOR_EACH_SAFE (port, port_next, p_entries, &hw->h_rports.p_entries) { diff --git a/lib/lldp/lldpd.c b/lib/lldp/lldpd.c index 1094e5bfe..e623f0586 100644 --- a/lib/lldp/lldpd.c +++ b/lib/lldp/lldpd.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #ifndef _WIN32 #include @@ -43,6 +42,7 @@ #include "compiler.h" #include "list.h" #include "packets.h" +#include "timeval.h" VLOG_DEFINE_THIS_MODULE(lldpd); @@ -268,7 +268,7 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s, (memcmp(oport->p_lastframe->frame, frame, s) == 0)) { /* Already received the same frame */ VLOG_DBG("duplicate frame, no need to decode"); - oport->p_lastupdate = time(NULL); + oport->p_lastupdate = time_now(); return; } } @@ -385,7 +385,7 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s, } /* Add port */ - port->p_lastchange = port->p_lastupdate = time(NULL); + port->p_lastchange = port->p_lastupdate = time_now(); port->p_lastframe = xmalloc(s + sizeof(struct lldpd_frame)); port->p_lastframe->size = s; memcpy(port->p_lastframe->frame, frame, s);