aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2008-05-15 00:00:19 +0000
committerYang Tse <yangsita@gmail.com>2008-05-15 00:00:19 +0000
commitcfc1d037ff16f7c5b6c90a49896e51baa7aff68f (patch)
tree5c32f6d0b3763a133bd37ce07cce5d3fcb814eef
parentc24ed07596abdb56e0f3511178755ca63cc8c746 (diff)
use same time source for timeout initialization and processing
-rw-r--r--ares/ares_init.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ares/ares_init.c b/ares/ares_init.c
index 278181362..0b9637105 100644
--- a/ares/ares_init.c
+++ b/ares/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));