From a43aec1b56aaba9bbe5ef585aa87c77f6f5cbb8e Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 15 May 2008 00:00:19 +0000 Subject: [PATCH] use same time source for timeout initialization and processing --- ares_init.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ares_init.c b/ares_init.c index 2781813..0b96371 100644 --- a/ares_init.c +++ b/ares_init.c @@ -108,6 +108,7 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, int i; int status = ARES_SUCCESS; struct server_state *server; + struct timeval now; #ifdef CURLDEBUG const char *env = getenv("CARES_MEMDEBUG"); @@ -125,6 +126,8 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, return ARES_ENOMEM; } + now = ares__tvnow(); + /* Set everything to distinguished values so we know they haven't * been set yet. */ @@ -147,7 +150,7 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, channel->sock_state_cb = NULL; channel->sock_state_cb_data = NULL; - channel->last_timeout_processed = (long)time(NULL); + channel->last_timeout_processed = (time_t)now.tv_sec; /* Initialize our lists of queries */ ares__init_list_head(&(channel->all_queries)); -- 2.7.4