timeoffset: made static and private

ares__timeoffset() was only used once within this single source file
This commit is contained in:
Daniel Stenberg 2013-08-27 13:06:57 +02:00
parent 30c9031afa
commit efdd616118
3 changed files with 8 additions and 13 deletions

View File

@ -311,9 +311,6 @@ struct ares_channeldata {
int ares__timedout(struct timeval *now,
struct timeval *check);
/* return time offset between now and (future) check, in milliseconds */
long ares__timeoffset(struct timeval *now,
struct timeval *check);
/* returns ARES_SUCCESS if library has been initialized */
int ares_library_initialized(void);
void ares__send_query(ares_channel channel, struct query *query,

View File

@ -115,15 +115,6 @@ static timeadd(struct timeval *now, int millisecs)
return 0;
}
/* return time offset between now and (future) check, in milliseconds */
long ares__timeoffset(struct timeval *now,
struct timeval *check)
{
return (check->tv_sec - now->tv_sec)*1000 +
(check->tv_usec - now->tv_usec)/1000;
}
/*
* generic process function
*/

View File

@ -23,6 +23,13 @@
#include "ares.h"
#include "ares_private.h"
/* return time offset between now and (future) check, in milliseconds */
static long timeoffset(struct timeval *now, struct timeval *check)
{
return (check->tv_sec - now->tv_sec)*1000 +
(check->tv_usec - now->tv_usec)/1000;
}
/* WARNING: Beware that this is linear in the number of outstanding
* requests! You are probably far better off just calling ares_process()
* once per second, rather than calling ares_timeout() to figure out
@ -53,7 +60,7 @@ struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv,
query = list_node->data;
if (query->timeout.tv_sec == 0)
continue;
offset = ares__timeoffset(&now, &query->timeout);
offset = timeoffset(&now, &query->timeout);
if (offset < 0)
offset = 0;
if (min_offset == -1 || offset < min_offset)