summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-01-18 19:36:41 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-01-18 19:36:41 +0000
commit7e46119759b7099c38f543bd38d0186b9806542f (patch)
treeb31264c454e26566b2e70c2794b89d77f4e28c44 /src/modules/m_spanningtree
parent42592c0083505777e8fb8e4bf09182528229a787 (diff)
Remove excessive gettimeofday system calls
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12293 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r--src/modules/m_spanningtree/main.cpp4
-rw-r--r--src/modules/m_spanningtree/pong.cpp8
-rw-r--r--src/modules/m_spanningtree/treeserver.cpp8
-rw-r--r--src/modules/m_spanningtree/treeserver.h2
4 files changed, 6 insertions, 16 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 4961d724b..18f399bbf 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -128,9 +128,7 @@ void ModuleSpanningTree::DoPingChecks(time_t curtime)
* Cancel remote burst mode on any servers which still have it enabled due to latency/lack of data.
* This prevents lost REMOTECONNECT notices
*/
- timeval t;
- gettimeofday(&t, NULL);
- long ts = (t.tv_sec * 1000) + (t.tv_usec / 1000);
+ long ts = ServerInstance->Time() * 1000 + (ServerInstance->Time_ns() / 1000000);
for (server_hash::iterator i = Utils->serverlist.begin(); i != Utils->serverlist.end(); i++)
{
diff --git a/src/modules/m_spanningtree/pong.cpp b/src/modules/m_spanningtree/pong.cpp
index dd82f7d86..9627da8c0 100644
--- a/src/modules/m_spanningtree/pong.cpp
+++ b/src/modules/m_spanningtree/pong.cpp
@@ -34,9 +34,7 @@ bool TreeSocket::LocalPong(const std::string &prefix, parameterlist &params)
if (ServerSource)
{
ServerSource->SetPingFlag();
- timeval t;
- gettimeofday(&t, NULL);
- long ts = (t.tv_sec * 1000) + (t.tv_usec / 1000);
+ long ts = ServerInstance->Time() * 1000 + (ServerInstance->Time_ns() / 1000000);
ServerSource->rtt = ts - ServerSource->LastPingMsec;
}
}
@@ -61,9 +59,7 @@ bool TreeSocket::LocalPong(const std::string &prefix, parameterlist &params)
if (ServerSource)
{
- timeval t;
- gettimeofday(&t, NULL);
- long ts = (t.tv_sec * 1000) + (t.tv_usec / 1000);
+ long ts = ServerInstance->Time() * 1000 + (ServerInstance->Time_ns() / 1000000);
ServerSource->rtt = ts - ServerSource->LastPingMsec;
ServerSource->SetPingFlag();
}
diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp
index d5c3927f9..00799aa8e 100644
--- a/src/modules/m_spanningtree/treeserver.cpp
+++ b/src/modules/m_spanningtree/treeserver.cpp
@@ -59,9 +59,7 @@ TreeServer::TreeServer(SpanningTreeUtilities* Util, std::string Name, std::strin
Warned = false;
rtt = 0;
- timeval t;
- gettimeofday(&t, NULL);
- long ts = (t.tv_sec * 1000) + (t.tv_usec / 1000);
+ long ts = ServerInstance->Time() * 1000 + (ServerInstance->Time_ns() / 1000000);
this->StartBurst = ts;
ServerInstance->Logs->Log("m_spanningtree",DEBUG, "Started bursting at time %lu", ts);
@@ -142,9 +140,7 @@ void TreeServer::FinishBurst()
{
FinishBurstInternal();
ServerInstance->XLines->ApplyLines();
- timeval t;
- gettimeofday(&t, NULL);
- long ts = (t.tv_sec * 1000) + (t.tv_usec / 1000);
+ long ts = ServerInstance->Time() * 1000 + (ServerInstance->Time_ns() / 1000000);
unsigned long bursttime = ts - this->StartBurst;
ServerInstance->SNO->WriteToSnoMask(Parent == Utils->TreeRoot ? 'l' : 'L', "Received end of netburst from \2%s\2 (burst time: %lu %s)",
ServerName.c_str(), (bursttime > 10000 ? bursttime / 1000 : bursttime), (bursttime > 10000 ? "secs" : "msecs"));
diff --git a/src/modules/m_spanningtree/treeserver.h b/src/modules/m_spanningtree/treeserver.h
index 9520506ae..079b6535e 100644
--- a/src/modules/m_spanningtree/treeserver.h
+++ b/src/modules/m_spanningtree/treeserver.h
@@ -109,7 +109,7 @@ class TreeServer : public classbase
*/
time_t NextPingTime();
- /** Last ping time in microseconds, used to calculate round trip time
+ /** Last ping time in milliseconds, used to calculate round trip time
*/
unsigned long LastPingMsec;