summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>2007-08-13 22:16:41 +0000
committerpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>2007-08-13 22:16:41 +0000
commite9d1efc1ae29ee86b3c2a42bf56531afac7add6d (patch)
treefc2a20298a9ac5d77a8a177f076f1319a0cfa039 /src/modules
parent410ab3372b07693f3531ecea03611c5b865bc68a (diff)
Fix new millisec /map to compile on windows, by ifndef gettimeofday out reverting back to seconds for latency.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7717 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_spanningtree/main.cpp7
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp4
2 files changed, 11 insertions, 0 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 3d472bf7a..ed54be0fb 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -174,7 +174,12 @@ std::string ModuleSpanningTree::TimeToStr(time_t secs)
const std::string ModuleSpanningTree::MapOperInfo(TreeServer* Current)
{
time_t secs_up = ServerInstance->Time() - Current->age;
+
+#ifndef WIN32
return (" [Up: " + TimeToStr(secs_up) + " Lag: "+ConvToStr(Current->rtt)+"ms]");
+#else
+ return (" [Up: " + TimeToStr(secs_up) + " Lag: "+ConvToStr(Current->rtt)+"s]");
+#endif
}
// WARNING: NOT THREAD SAFE - DONT GET ANY SMART IDEAS.
@@ -487,10 +492,12 @@ void ModuleSpanningTree::DoPingChecks(time_t curtime)
sock->WriteLine(std::string(":")+ServerInstance->Config->ServerName+" PING "+serv->GetName());
serv->SetNextPingTime(curtime + Utils->PingFreq);
serv->LastPing = curtime;
+#ifndef WIN32
timeval t;
gettimeofday(&t, NULL);
long ts = (t.tv_sec * 1000) + (t.tv_usec / 1000);
serv->LastPingMsec = ts;
+#endif
serv->Warned = false;
}
else
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index 88c7666bf..527c0122b 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -365,10 +365,14 @@ bool TreeSocket::LocalPong(const std::string &prefix, std::deque<std::string> &p
if (ServerSource)
{
ServerSource->SetPingFlag();
+#ifndef WIN32
timeval t;
gettimeofday(&t, NULL);
long ts = (t.tv_sec * 1000) + (t.tv_usec / 1000);
ServerSource->rtt = ts - ServerSource->LastPingMsec;
+#else
+ ServerSource->rtt = Instance->Time() - ServerSource->LastPing;
+#endif
}
}
else