summaryrefslogtreecommitdiff
path: root/src/commands/cmd_time.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/cmd_time.cpp')
-rw-r--r--src/commands/cmd_time.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/commands/cmd_time.cpp b/src/commands/cmd_time.cpp
index db452d381..8c516ac42 100644
--- a/src/commands/cmd_time.cpp
+++ b/src/commands/cmd_time.cpp
@@ -50,16 +50,13 @@ CmdResult CommandTime::Handle (const std::vector<std::string>& parameters, User
{
if (parameters.size() > 0 && parameters[0] != ServerInstance->Config->ServerName)
return CMD_SUCCESS;
- struct tm* timeinfo;
- time_t local = ServerInstance->Time();
-
- timeinfo = localtime(&local);
- char tms[26];
- snprintf(tms,26,"%s",asctime(timeinfo));
- tms[24] = 0;
+ time_t local = ServerInstance->Time();
+ struct tm* timeinfo = localtime(&local);
+ const std::string& humanTime = asctime(timeinfo);
- user->SendText(":%s %03d %s %s :%s", ServerInstance->Config->ServerName.c_str(), RPL_TIME, user->nick.c_str(),ServerInstance->Config->ServerName.c_str(),tms);
+ user->SendText(":%s %03d %s %s :%s", ServerInstance->Config->ServerName.c_str(), RPL_TIME, user->nick.c_str(),
+ ServerInstance->Config->ServerName.c_str(), humanTime.c_str());
return CMD_SUCCESS;
}