From 40caf0ad9bef07bdfb568a88192c157dd1840100 Mon Sep 17 00:00:00 2001 From: "David M. Lee" Date: Fri, 24 Jul 2015 17:04:35 -0500 Subject: Replaces clock_gettime() with ast_tsnow() clock_gettime() is, unfortunately, not portable. But I did like that over our usual `ts.tv_nsec = tv.tv_usec * 1000` copy/paste code we usually do when we want a timespec and all we have is ast_tvnow(). This patch adds ast_tsnow(), which mimics ast_tvnow(), but returns a timespec. If clock_gettime() is available, it will use that. Otherwise ast_tsnow() falls back to using ast_tvnow(). Change-Id: Ibb1ee67ccf4826b9b76d5a5eb62e90b29b6c456e --- tests/test_dns.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/test_dns.c') diff --git a/tests/test_dns.c b/tests/test_dns.c index 4e2c4a464..718cffc50 100644 --- a/tests/test_dns.c +++ b/tests/test_dns.c @@ -694,7 +694,7 @@ static void *resolution_thread(void *dns_query) static const size_t V4_BUFSIZE = sizeof(struct in_addr); char v4_buf[V4_BUFSIZE]; - clock_gettime(CLOCK_REALTIME, &timeout); + timeout = ast_tsnow(); timeout.tv_sec += 5; ast_mutex_lock(&test_resolver_data.lock); @@ -1089,7 +1089,7 @@ AST_TEST_DEFINE(resolver_resolve_async) goto cleanup; } - clock_gettime(CLOCK_REALTIME, &timeout); + timeout = ast_tsnow(); timeout.tv_sec += 10; ast_mutex_lock(&async_data->lock); while (!async_data->complete) { @@ -1279,7 +1279,7 @@ AST_TEST_DEFINE(resolver_resolve_async_cancel) goto cleanup; } - clock_gettime(CLOCK_REALTIME, &timeout); + timeout = ast_tsnow(); timeout.tv_sec += 10; ast_mutex_lock(&async_data->lock); while (!async_data->complete) { -- cgit v1.2.3