diff options
author | Everton Marques <everton.marques@gmail.com> | 2014-09-18 14:54:07 -0300 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2015-02-04 06:08:00 +0100 |
commit | 679fab42343381f609527166f48dbf9ba19f3aab (patch) | |
tree | 346b58915f873c9cec7234f7ba772db066993f0b | |
parent | 4d330a2719fd684739a16c6aa3be6632bc3745a2 (diff) | |
download | quagga-679fab42343381f609527166f48dbf9ba19f3aab.tar.bz2 quagga-679fab42343381f609527166f48dbf9ba19f3aab.tar.xz |
pimd: Simplify gettime-related code.
-rw-r--r-- | pimd/Makefile.am | 4 | ||||
-rw-r--r-- | pimd/pim_main.c | 8 | ||||
-rw-r--r-- | pimd/pim_time.c | 47 |
3 files changed, 0 insertions, 59 deletions
diff --git a/pimd/Makefile.am b/pimd/Makefile.am index 3b8a0e17..7173a231 100644 --- a/pimd/Makefile.am +++ b/pimd/Makefile.am @@ -25,8 +25,6 @@ # PIM_REPORT_RECV_IFINDEX_MISMATCH: Report sock/recv ifindex mismatch # PIM_ENFORCE_LOOPFREE_MFC: Refuse adding looping MFC entries # PIM_UNEXPECTED_KERNEL_UPCALL: Report unexpected kernel upcall -# PIM_USE_QUAGGA_GETTIME: Prefer quagga_gettime -# PIM_GETTIME_USE_GETTIMEOFDAY: Work-around improper monotonic clock PIM_DEFS = #PIM_DEFS += -DPIM_DEBUG_BYDEFAULT @@ -35,8 +33,6 @@ PIM_DEFS += -DPIM_CHECK_RECV_IFINDEX_SANITY PIM_DEFS += -DPIM_ZCLIENT_DEBUG PIM_DEFS += -DPIM_ENFORCE_LOOPFREE_MFC #PIM_DEFS += -DPIM_UNEXPECTED_KERNEL_UPCALL -#PIM_DEFS += -DPIM_USE_QUAGGA_GETTIME -PIM_DEFS += -DPIM_GETTIME_USE_GETTIMEOFDAY INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" $(PIM_DEFS) diff --git a/pimd/pim_main.c b/pimd/pim_main.c index 0ae4ae9c..c646356a 100644 --- a/pimd/pim_main.c +++ b/pimd/pim_main.c @@ -272,14 +272,6 @@ int main(int argc, char** argv, char** envp) { zlog_notice("PIM_UNEXPECTED_KERNEL_UPCALL: report unexpected kernel upcall"); #endif -#ifdef PIM_USE_QUAGGA_GETTIME - zlog_notice("PIM_USE_QUAGGA_GETTIME: using Quagga's quagga_gettime"()); -#endif - -#ifdef PIM_GETTIME_USE_GETTIMEOFDAY - zlog_notice("PIM_GETTIME_USE_GETTIMEOFDAY: work-around improper monotonic clock"); -#endif - #ifdef HAVE_CLOCK_MONOTONIC zlog_notice("HAVE_CLOCK_MONOTONIC"); #else diff --git a/pimd/pim_time.c b/pimd/pim_time.c index fce30c08..097b470b 100644 --- a/pimd/pim_time.c +++ b/pimd/pim_time.c @@ -30,63 +30,16 @@ #include "pim_time.h" -#ifndef PIM_GETTIME_USE_GETTIMEOFDAY -static int pim_gettime(int clk_id, struct timeval *tv) -{ - struct timespec ts; - int result; - -#ifdef PIM_USE_QUAGGA_GETTIME - result = quagga_gettime(clk_id, tv); - if (result) { - zlog_err("%s: quagga_gettime(clk_id=%d) failure: errno=%d: %s", - __PRETTY_FUNCTION__, clk_id, - errno, safe_strerror(errno)); - } -#else - result = clock_gettime(clk_id, &ts); - if (result) { - zlog_err("%s: clock_gettime(clk_id=%d) failure: errno=%d: %s", - __PRETTY_FUNCTION__, clk_id, - errno, safe_strerror(errno)); - return result; - } - if (tv) { - tv->tv_sec = ts.tv_sec; - tv->tv_usec = 1000 * ts.tv_nsec; - } -#endif - - return result; -} -#endif - static int gettime_monotonic(struct timeval *tv) { int result; -#ifdef PIM_GETTIME_USE_GETTIMEOFDAY result = gettimeofday(tv, 0); if (result) { zlog_err("%s: gettimeofday() failure: errno=%d: %s", __PRETTY_FUNCTION__, errno, safe_strerror(errno)); } -#elif defined(PIM_USE_QUAGGA_GETTIME) - result = pim_gettime(QUAGGA_CLK_MONOTONIC, tv); - if (result) { - zlog_err("%s: pim_gettime(QUAGGA_CLK_MONOTONIC=%d) failure: errno=%d: %s", - __PRETTY_FUNCTION__, QUAGGA_CLK_MONOTONIC, - errno, safe_strerror(errno)); - } -#else - result = pim_gettime(CLOCK_MONOTONIC, tv); - if (result) { - zlog_err("%s: pim_gettime(CLOCK_MONOTONIC=%d) failure: errno=%d: %s", - __PRETTY_FUNCTION__, CLOCK_MONOTONIC, - errno, safe_strerror(errno)); - } -#endif return result; } |