From 9f8525e3b20ff08d74f05438e4dce7a50aaa797b Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 13 Mar 2025 10:47:18 +0000 Subject: Refactor the TIME handler. --- src/messages.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/messages.cpp') 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 ¶ms, void Time::Run(MessageSource &source, const std::vector ¶ms, const Anope::map &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 ¶ms, const Anope::map &tags) -- cgit