]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/cmd_time.cpp
Change to use std::string::iterator rather than making a copy of the pointer and...
[user/henk/code/inspircd.git] / src / cmd_time.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #include "configreader.h"
15 #include "users.h"
16 #include "commands/cmd_time.h"
17
18
19
20 extern "C" command_t* init_command(InspIRCd* Instance)
21 {
22         return new cmd_time(Instance);
23 }
24
25 CmdResult cmd_time::Handle (const char** parameters, int pcnt, userrec *user)
26 {
27         struct tm* timeinfo;
28         time_t local = ServerInstance->Time();
29
30         timeinfo = localtime(&local);
31
32         char tms[26];
33         snprintf(tms,26,"%s",asctime(timeinfo));
34         tms[24] = 0;
35
36         user->WriteServ("391 %s %s :%s",user->nick,ServerInstance->Config->ServerName,tms);
37
38         return CMD_SUCCESS;
39 }