Skip to content

Commit

Permalink
lldp: Use OVS time functions.
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Pfaff <blp@nicira.com>
  • Loading branch information
blp committed Mar 4, 2015
1 parent 4eb6eec commit d9f3b69
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions 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 <bernat@luffy.cx>
*
* Permission to use, copy, modify, and/or distribute this software for any
Expand All @@ -18,9 +19,9 @@
#include <config.h>
#include "lldpd-structs.h"
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include "lldpd.h"
#include "timeval.h"

VLOG_DEFINE_THIS_MODULE(lldpd_structs);

Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions lib/lldp/lldpd.c
Expand Up @@ -30,7 +30,6 @@
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <time.h>
#include <unistd.h>
#ifndef _WIN32
#include <grp.h>
Expand All @@ -43,6 +42,7 @@
#include "compiler.h"
#include "list.h"
#include "packets.h"
#include "timeval.h"

VLOG_DEFINE_THIS_MODULE(lldpd);

Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit d9f3b69

Please sign in to comment.