1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
19 /* $ModDesc: Display timestamps from all servers connected to the network */
21 class cmd_alltime : public command_t
24 cmd_alltime(InspIRCd *Instance) : command_t(Instance, "ALLTIME", 'o', 0)
26 this->source = "m_alltime.so";
30 CmdResult Handle(const char **parameters, int pcnt, userrec *user)
34 time_t now = ServerInstance->Time(false);
35 strftime(fmtdate, sizeof(fmtdate), "%F %T", gmtime(&now));
36 now = ServerInstance->Time(true);
37 strftime(fmtdate2, sizeof(fmtdate2), "%F %T", gmtime(&now));
39 int delta = ServerInstance->GetTimeDelta();
41 string msg = ":" + string(ServerInstance->Config->ServerName) + " NOTICE " + user->nick + " :System time for " +
42 ServerInstance->Config->ServerName + " is: " + fmtdate + " (delta " + ConvToStr(delta) + " seconds): Time with delta: "+ fmtdate2;
51 params.push_back(user->nick);
52 params.push_back(msg);
53 Event ev((char *) ¶ms, NULL, "send_push");
54 ev.Send(ServerInstance);
57 /* we want this routed out! */
62 class Modulealltime : public Module
64 cmd_alltime *mycommand;
66 Modulealltime(InspIRCd *Me)
69 mycommand = new cmd_alltime(ServerInstance);
70 ServerInstance->AddCommand(mycommand);
73 virtual ~Modulealltime()
77 virtual Version GetVersion()
79 return Version(1, 0, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
84 class ModulealltimeFactory : public ModuleFactory
87 ModulealltimeFactory()
91 ~ModulealltimeFactory()
95 virtual Module *CreateModule(InspIRCd *Me)
97 return new Modulealltime(Me);
102 extern "C" void *init_module(void)
104 return new ModulealltimeFactory;