summaryrefslogtreecommitdiff
path: root/src/messages.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2025-03-13 10:47:18 +0000
committerSadie Powell <sadie@witchery.services>2025-03-13 10:47:18 +0000
commit9f8525e3b20ff08d74f05438e4dce7a50aaa797b (patch)
tree644939333b5750fd6d8971b411b8ace8563859e0 /src/messages.cpp
parentace82596d895dcbeeb846ccd1dd721080ad89988 (diff)
Refactor the TIME handler.
Diffstat (limited to 'src/messages.cpp')
-rw-r--r--src/messages.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/messages.cpp b/src/messages.cpp
index 391b3d330..273ab827b 100644
--- a/src/messages.cpp
+++ b/src/messages.cpp
@@ -438,13 +438,11 @@ void Stats::Run(MessageSource &source, const std::vector<Anope::string> &params,
void Time::Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags)
{
- time_t t;
- time(&t);
- struct tm *tm = localtime(&t);
- char buf[64];
- strftime(buf, sizeof(buf), "%a %b %d %H:%M:%S %Y %Z", tm);
- IRCD->SendNumeric(RPL_TIME, source.GetSource(), Me->GetName(), buf);
- return;
+ const auto *tm = localtime(&Anope::CurTime);
+ char timebuf[64];
+ strftime(timebuf, sizeof(timebuf), "%A, %d %B %Y @ %H:%M:%S %Z", tm);
+ const auto timestr = Anope::printf("%s (%lu)", timebuf, Anope::CurTime);
+ IRCD->SendNumeric(RPL_TIME, source.GetSource(), Me->GetName(), timestr);
}
void Topic::Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags)