inspircd

A modular C++ IRC daemon (ircd). https://www.inspircd.org/
Log | Files | Refs | README

commit 7a58d288d0fd005795a8ac6908fc91bf350174d6
parent 510f747854b17f64c2f597a4bd5743763fb518f4
Author: Peter Powell <petpow@saberuk.com>
Date:   Tue, 14 May 2019 00:51:31 +0100

Replace ModuleSpanningTree::TimeToStr with InspIRCd::DurationStr.

Diffstat:
Msrc/modules/m_spanningtree/main.cpp | 14--------------
Msrc/modules/m_spanningtree/main.h | 4----
Msrc/modules/m_spanningtree/override_map.cpp | 2+-
Msrc/modules/m_spanningtree/treesocket2.cpp | 2+-
4 files changed, 2 insertions(+), 20 deletions(-)

diff --git 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 @@ -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 @@ -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 @@ -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()); } }