1 /* Written by Special (john@yarbbles.com) */
10 /* $ModDesc: Display timestamps from all servers connected to the network */
12 class cmd_alltime : public command_t
15 cmd_alltime(InspIRCd *Instance) : command_t(Instance, "ALLTIME", 'o', 0)
17 this->source = "m_alltime.so";
21 CmdResult Handle(const char **parameters, int pcnt, userrec *user)
24 time_t now = ServerInstance->Time();
25 strftime(fmtdate, sizeof(fmtdate), "%F %T", gmtime(&now));
27 int delta = ServerInstance->GetTimeDelta();
29 string msg = ":" + string(ServerInstance->Config->ServerName) + " NOTICE " + user->nick + " :Time for " +
30 ServerInstance->Config->ServerName + " is: " + fmtdate + " (delta " + ConvToStr(delta) + " seconds)";
39 params.push_back(user->nick);
40 params.push_back(msg);
41 Event ev((char *) ¶ms, NULL, "send_push");
42 ev.Send(ServerInstance);
49 class Modulealltime : public Module
51 cmd_alltime *mycommand;
53 Modulealltime(InspIRCd *Me)
56 mycommand = new cmd_alltime(ServerInstance);
57 ServerInstance->AddCommand(mycommand);
60 virtual ~Modulealltime()
64 virtual Version GetVersion()
66 return Version(1, 0, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
71 class ModulealltimeFactory : public ModuleFactory
74 ModulealltimeFactory()
78 ~ModulealltimeFactory()
82 virtual Module *CreateModule(InspIRCd *Me)
84 return new Modulealltime(Me);
89 extern "C" void *init_module(void)
91 return new ModulealltimeFactory;