diff options
Diffstat (limited to 'pimd')
-rw-r--r-- | pimd/pim_main.c | 6 | ||||
-rw-r--r-- | pimd/pim_time.c | 38 | ||||
-rw-r--r-- | pimd/pim_version.h | 2 |
3 files changed, 36 insertions, 10 deletions
diff --git a/pimd/pim_main.c b/pimd/pim_main.c index 3cf1869c..2efcbb8c 100644 --- a/pimd/pim_main.c +++ b/pimd/pim_main.c @@ -285,6 +285,12 @@ Hello, this is " QUAGGA_PROGNAME " " QUAGGA_VERSION " " PIMD_PROGNAME " " PIMD_V zlog_notice("PIM_UNEXPECTED_KERNEL_UPCALL: report unexpected kernel upcall"); #endif +#ifdef HAVE_CLOCK_MONOTONIC + zlog_notice("HAVE_CLOCK_MONOTONIC"); +#else + zlog_notice("!HAVE_CLOCK_MONOTONIC"); +#endif + /* Initialize zclient "update" and "lookup" sockets */ diff --git a/pimd/pim_time.c b/pimd/pim_time.c index 63861e5c..a4b1cc46 100644 --- a/pimd/pim_time.c +++ b/pimd/pim_time.c @@ -30,12 +30,32 @@ #include "pim_time.h" -/* - see man clock_gettime - */ -static int pim_gettime(clockid_t clk_id, struct timeval *tv) +static int pim_gettime(enum quagga_clkid clkid, struct timeval *tv) +{ + int result; + + result = quagga_gettime(clkid, tv); + if (result) { + zlog_err("%s: quagga_gettime(clkid=%d) failure: errno=%d: %s", + __PRETTY_FUNCTION__, clkid, + errno, safe_strerror(errno)); + } + + return result; +} + +static int gettime_monotonic(struct timeval *tv) { - return quagga_gettime(clk_id, tv); + int result; + + result = pim_gettime(QUAGGA_CLK_MONOTONIC, tv); + if (result) { + zlog_err("%s: pim_gettime(QUAGGA_CLK_MONOTONIC=%d) failure: errno=%d: %s", + __PRETTY_FUNCTION__, CLOCK_MONOTONIC, + errno, safe_strerror(errno)); + } + + return result; } /* @@ -46,8 +66,8 @@ int64_t pim_time_monotonic_sec() { struct timeval now_tv; - if (pim_gettime(CLOCK_MONOTONIC, &now_tv)) { - zlog_err("%s: gettime(CLOCK_MONOTONIC) failure: errno=%d: %s", + if (gettime_monotonic(&now_tv)) { + zlog_err("%s: gettime_monotonic() failure: errno=%d: %s", __PRETTY_FUNCTION__, errno, safe_strerror(errno)); return -1; @@ -65,8 +85,8 @@ int64_t pim_time_monotonic_dsec() struct timeval now_tv; int64_t now_dsec; - if (pim_gettime(CLOCK_MONOTONIC, &now_tv)) { - zlog_err("%s: gettime(CLOCK_MONOTONIC) failure: errno=%d: %s", + if (gettime_monotonic(&now_tv)) { + zlog_err("%s: gettime_monotonic() failure: errno=%d: %s", __PRETTY_FUNCTION__, errno, safe_strerror(errno)); return -1; diff --git a/pimd/pim_version.h b/pimd/pim_version.h index ef75791e..2734b7ac 100644 --- a/pimd/pim_version.h +++ b/pimd/pim_version.h @@ -23,7 +23,7 @@ #ifndef PIM_VERSION_H #define PIM_VERSION_H -#define PIMD_VERSION_STR "0.160" +#define PIMD_VERSION_STR "0.161" const char * const PIMD_VERSION; |