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 // I'm too lazy to add a function to fetch the delta, so lets just cheat..
28 int delta = time(NULL) - now;
30 string msg = ":" + string(ServerInstance->Config->ServerName) + " NOTICE " + user->nick + " :Time for " +
31 ServerInstance->Config->ServerName + " is: " + fmtdate + " (delta " + ConvToStr(delta) + " seconds)";
40 params.push_back(user->nick);
41 params.push_back(msg);
42 Event ev((char *) ¶ms, NULL, "send_push");
43 ev.Send(ServerInstance);
50 class Modulealltime : public Module
52 cmd_alltime *mycommand;
54 Modulealltime(InspIRCd *Me)
57 mycommand = new cmd_alltime(ServerInstance);
58 ServerInstance->AddCommand(mycommand);
61 virtual ~Modulealltime()
65 virtual Version GetVersion()
67 return Version(1, 0, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
72 class ModulealltimeFactory : public ModuleFactory
75 ModulealltimeFactory()
79 ~ModulealltimeFactory()
83 virtual Module *CreateModule(InspIRCd *Me)
85 return new Modulealltime(Me);
90 extern "C" void *init_module(void)
92 return new ModulealltimeFactory;