summaryrefslogtreecommitdiff
path: root/babeld
diff options
context:
space:
mode:
authorJuliusz Chroboczek <jch@pps.jussieu.fr>2012-02-09 13:35:27 +0100
committerPaul Jakma <paul@quagga.net>2012-03-25 17:06:53 +0100
commit82509bfde09b15ac8856a374aac6d5d62b91f54a (patch)
treec9e45fb9cba3fd9b64357537e8fe342bb9fe38ad /babeld
parentb6475ecb14abab936919894050f9ca47415d0f48 (diff)
babeld: Use quagga_gettime.
Diffstat (limited to 'babeld')
-rw-r--r--babeld/kernel.c39
1 files changed, 1 insertions, 38 deletions
diff --git a/babeld/kernel.c b/babeld/kernel.c
index 4b5bd7b2..c31f617b 100644
--- a/babeld/kernel.c
+++ b/babeld/kernel.c
@@ -50,44 +50,7 @@ THE SOFTWARE.
int
gettime(struct timeval *tv)
{
- int rc;
- static time_t offset = 0, previous = 0;
-
-#if defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0 && defined(CLOCK_MONOTONIC)
- static int have_posix_clocks = -1;
-
- if(UNLIKELY(have_posix_clocks < 0)) {
- struct timespec ts;
- rc = clock_gettime(CLOCK_MONOTONIC, &ts);
- if(rc < 0) {
- have_posix_clocks = 0;
- } else {
- have_posix_clocks = 1;
- }
- }
-
- if(have_posix_clocks) {
- struct timespec ts;
- int rc;
- rc = clock_gettime(CLOCK_MONOTONIC, &ts);
- if(rc < 0)
- return rc;
- tv->tv_sec = ts.tv_sec;
- tv->tv_usec = ts.tv_nsec / 1000;
- return rc;
- }
-#endif
-
- rc = gettimeofday(tv, NULL);
- if(rc < 0)
- return rc;
- tv->tv_sec += offset;
- if(UNLIKELY(previous > tv->tv_sec)) {
- offset += previous - tv->tv_sec;
- tv->tv_sec = previous;
- }
- previous = tv->tv_sec;
- return rc;
+ return quagga_gettime(QUAGGA_CLK_MONOTONIC, tv);
}
/* If /dev/urandom doesn't exist, this will fail with ENOENT, which the