summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2019-05-14 00:51:31 +0100
committerPeter Powell <petpow@saberuk.com>2019-05-14 00:58:52 +0100
commit7a58d288d0fd005795a8ac6908fc91bf350174d6 (patch)
tree42254e919716ea7723ca5a35ae10d0f8b23c46a0 /src/modules
parent510f747854b17f64c2f597a4bd5743763fb518f4 (diff)
Replace ModuleSpanningTree::TimeToStr with InspIRCd::DurationStr.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_spanningtree/main.cpp14
-rw-r--r--src/modules/m_spanningtree/main.h4
-rw-r--r--src/modules/m_spanningtree/override_map.cpp2
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp2
4 files changed, 2 insertions, 20 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 8b24b1e22..44271473c 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -145,20 +145,6 @@ void ModuleSpanningTree::HandleLinks(const CommandBase::Params& parameters, User
user->WriteNumeric(RPL_ENDOFLINKS, '*', "End of /LINKS list.");
}
-std::string ModuleSpanningTree::TimeToStr(time_t secs)
-{
- time_t mins_up = secs / 60;
- time_t hours_up = mins_up / 60;
- time_t days_up = hours_up / 24;
- secs = secs % 60;
- mins_up = mins_up % 60;
- hours_up = hours_up % 24;
- return ((days_up ? (ConvToStr(days_up) + "d") : "")
- + (hours_up ? (ConvToStr(hours_up) + "h") : "")
- + (mins_up ? (ConvToStr(mins_up) + "m") : "")
- + ConvToStr(secs) + "s");
-}
-
void ModuleSpanningTree::ConnectServer(Autoconnect* a, bool on_timer)
{
if (!a)
diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h
index 989fa1311..5d6fd5d99 100644
--- a/src/modules/m_spanningtree/main.h
+++ b/src/modules/m_spanningtree/main.h
@@ -142,10 +142,6 @@ class ModuleSpanningTree
*/
ModResult HandleConnect(const CommandBase::Params& parameters, User* user);
- /** Display a time as a human readable string
- */
- static std::string TimeToStr(time_t secs);
-
const Events::ModuleEventProvider& GetEventProvider() const { return eventprov; }
/**
diff --git a/src/modules/m_spanningtree/override_map.cpp b/src/modules/m_spanningtree/override_map.cpp
index 693b07bad..735bc7148 100644
--- a/src/modules/m_spanningtree/override_map.cpp
+++ b/src/modules/m_spanningtree/override_map.cpp
@@ -93,7 +93,7 @@ static std::vector<std::string> GetMap(User* user, TreeServer* current, unsigned
if (user->IsOper())
{
time_t secs_up = ServerInstance->Time() - current->age;
- buffer += " [Up: " + ModuleSpanningTree::TimeToStr(secs_up) + (current->rtt == 0 ? "]" : " Lag: " + ConvToStr(current->rtt) + "ms]");
+ buffer += " [Up: " + InspIRCd::DurationString(secs_up) + (current->rtt == 0 ? "]" : " Lag: " + ConvToStr(current->rtt) + "ms]");
}
std::vector<std::string> map;
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index 05d85aa67..ca2e4ec80 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -422,7 +422,7 @@ void TreeSocket::Close()
time_t server_uptime = ServerInstance->Time() - this->age;
if (server_uptime)
{
- std::string timestr = ModuleSpanningTree::TimeToStr(server_uptime);
+ std::string timestr = InspIRCd::DurationString(server_uptime);
ServerInstance->SNO->WriteGlobalSno('l', "Connection to '\002%s\002' was established for %s", linkID.c_str(), timestr.c_str());
}
}