]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_alltime.cpp
Unite SSL service providers and SSL profile classes
[user/henk/code/inspircd.git] / src / modules / m_alltime.cpp
index aba8fe7fe1489223b5b0b044d7029728e710511b..73c0fa994f0443e2819d6b7df83c063db4b24863 100644 (file)
 
 #include "inspircd.h"
 
-/* $ModDesc: Display timestamps from all servers connected to the network */
-
 class CommandAlltime : public Command
 {
  public:
        CommandAlltime(Module* Creator) : Command(Creator, "ALLTIME", 0)
        {
-               flags_needed = 'o'; syntax.clear();
-               translation.push_back(TR_END);
+               flags_needed = 'o';
        }
 
        CmdResult Handle(const std::vector<std::string> &parameters, User *user)
        {
-               char fmtdate[64];
-               time_t now = ServerInstance->Time();
-               strftime(fmtdate, sizeof(fmtdate), "%Y-%m-%d %H:%M:%S", gmtime(&now));
+               const std::string fmtdate = InspIRCd::TimeString(ServerInstance->Time(), "%Y-%m-%d %H:%M:%S", true);
 
-               std::string msg = ":" + std::string(ServerInstance->Config->ServerName.c_str()) + " NOTICE " + user->nick + " :System time is " + fmtdate + "(" + ConvToStr(ServerInstance->Time()) + ") on " + ServerInstance->Config->ServerName;
+               std::string msg = "System time is " + fmtdate + " (" + ConvToStr(ServerInstance->Time()) + ") on " + ServerInstance->Config->ServerName;
 
-               user->SendText(msg);
+               user->WriteRemoteNotice(msg);
 
                /* we want this routed out! */
                return CMD_SUCCESS;
@@ -52,22 +47,16 @@ class CommandAlltime : public Command
        }
 };
 
-
 class Modulealltime : public Module
 {
        CommandAlltime mycommand;
  public:
        Modulealltime()
                : mycommand(this)
-       {
-               ServerInstance->AddCommand(&mycommand);
-       }
-
-       virtual ~Modulealltime()
        {
        }
 
-       virtual Version GetVersion()
+       Version GetVersion() CXX11_OVERRIDE
        {
                return Version("Display timestamps from all servers connected to the network", VF_OPTCOMMON | VF_VENDOR);
        }