1
0
mirror of https://github.com/anope/anope.git synced 2026-06-27 05:06:38 +02:00

Added Anope::CurTime to keep us from calling time() everywhere

This commit is contained in:
Adam
2010-09-10 20:31:31 -04:00
parent 9eb7562bee
commit f00e76d30a
64 changed files with 224 additions and 240 deletions
+3 -4
View File
@@ -192,7 +192,7 @@ inline DNSRecord::DNSRecord()
{
this->type = DNS_QUERY_NONE;
this->record_class = this->ttl = this->rdlength = 0;
this->created = time(NULL);
this->created = Anope::CurTime;
}
DNSSocket::DNSSocket(const Anope::string &nTargetHost, int nPort) : ClientSocket(nTargetHost, nPort, "", false, SOCK_DGRAM)
@@ -471,7 +471,7 @@ bool DNSSocket::ProcessWrite()
return cont;
}
DNSManager::DNSManager() : Timer(3600, time(NULL), true)
DNSManager::DNSManager() : Timer(3600, Anope::CurTime, true)
{
this->sock = NULL;
@@ -502,11 +502,10 @@ bool DNSManager::CheckCache(DNSRequest *request)
{
std::multimap<Anope::string, DNSRecord *>::iterator it_end = this->cache.upper_bound(request->address);
time_t now = time(NULL);
for (; it != it_end; ++it)
{
DNSRecord *rec = it->second;
if (rec->created + rec->ttl >= now)
if (rec->created + rec->ttl >= Anope::CurTime)
{
request->OnLookupComplete(rec);
}