summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-04-06 19:18:08 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-04-06 19:18:08 +0000
commitf9110f02e7483530d46eb892999d09edb131ec7f (patch)
treee887d5cf65cf8c7e8667b6db15559a9b00c484b2
parent578f32db3ca4c05763d0eb6d9b5198e677b6f200 (diff)
We had to roll our own time function because some craqsmoker thought having a carriage return on the end of ctime and asctime was a great idea, and the only other solution is to fanny around with
strftime. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6749 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/inspircd.h4
-rw-r--r--src/cmd_eline.cpp2
-rw-r--r--src/cmd_gline.cpp2
-rw-r--r--src/cmd_kline.cpp2
-rw-r--r--src/cmd_zline.cpp4
-rw-r--r--src/command_parse.cpp5
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp2
7 files changed, 16 insertions, 5 deletions
diff --git a/include/inspircd.h b/include/inspircd.h
index 293a3ba42..bfd2ea421 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -1241,6 +1241,10 @@ class InspIRCd : public classbase
*/
void ResetMaxBans();
+ /** Return a time_t as a human-readable string.
+ */
+ std::string TimeString(time_t curtime);
+
/** Begin execution of the server.
* NOTE: this function NEVER returns. Internally,
* after performing some initialisation routines,
diff --git a/src/cmd_eline.cpp b/src/cmd_eline.cpp
index 803f08b03..ed7525e05 100644
--- a/src/cmd_eline.cpp
+++ b/src/cmd_eline.cpp
@@ -49,7 +49,7 @@ CmdResult cmd_eline::Handle (const char** parameters, int pcnt, userrec *user)
{
time_t c_requires_crap = ServerInstance->Duration(parameters[1]) + ServerInstance->Time();
ServerInstance->SNO->WriteToSnoMask('x',"%s added timed E-line for %s, expires on %s",user->nick,parameters[0],
- ctime(&c_requires_crap));
+ ServerInstance->TimeString(c_requires_crap).c_str());
}
}
}
diff --git a/src/cmd_gline.cpp b/src/cmd_gline.cpp
index d929414c1..98f088c8b 100644
--- a/src/cmd_gline.cpp
+++ b/src/cmd_gline.cpp
@@ -57,7 +57,7 @@ CmdResult cmd_gline::Handle (const char** parameters, int pcnt, userrec *user)
{
time_t c_requires_crap = ServerInstance->Duration(parameters[1]) + ServerInstance->Time();
ServerInstance->SNO->WriteToSnoMask('x',"%s added timed G-line for %s, expires on %s",user->nick,parameters[0],
- ctime(&c_requires_crap));
+ ServerInstance->TimeString(c_requires_crap).c_str());
}
ServerInstance->XLines->apply_lines(to_apply);
diff --git a/src/cmd_kline.cpp b/src/cmd_kline.cpp
index 0ddd8a5a1..e7ec7b617 100644
--- a/src/cmd_kline.cpp
+++ b/src/cmd_kline.cpp
@@ -57,7 +57,7 @@ CmdResult cmd_kline::Handle (const char** parameters, int pcnt, userrec *user)
{
time_t c_requires_crap = ServerInstance->Duration(parameters[1]) + ServerInstance->Time();
ServerInstance->SNO->WriteToSnoMask('x',"%s added timed K-line for %s, expires on %s",user->nick,parameters[0],
- ctime(&c_requires_crap));
+ ServerInstance->TimeString(c_requires_crap).c_str());
}
ServerInstance->XLines->apply_lines(to_apply);
diff --git a/src/cmd_zline.cpp b/src/cmd_zline.cpp
index f2b14c5ba..70ca81664 100644
--- a/src/cmd_zline.cpp
+++ b/src/cmd_zline.cpp
@@ -50,7 +50,9 @@ CmdResult cmd_zline::Handle (const char** parameters, int pcnt, userrec *user)
}
else
{
- ServerInstance->SNO->WriteToSnoMask('x',"%s added timed Z-line for %s, expires in %d seconds.",user->nick,parameters[0],ServerInstance->Duration(parameters[1]));
+ time_t c_requires_crap = ServerInstance->Duration(parameters[1]) + ServerInstance->Time();
+ ServerInstance->SNO->WriteToSnoMask('x',"%s added timed Z-line for %s, expires on %s",user->nick,parameters[0],
+ ServerInstance->TimeString(c_requires_crap).c_str());
}
ServerInstance->XLines->apply_lines(to_apply);
}
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index a59d6db62..bf04960bd 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -53,6 +53,11 @@ int InspIRCd::OperPassCompare(const char* data,const char* input, int tagnumber)
return strcmp(data,input);
}
+std::string InspIRCd::TimeString(time_t curtime)
+{
+ return std::string(ctime(&curtime),24);
+}
+
long InspIRCd::Duration(const char* str)
{
char n_field[MAXBUF];
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index c78bb26ab..217294021 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -544,7 +544,7 @@ bool TreeSocket::AddLine(const std::string &prefix, std::deque<std::string> &par
if (atoi(params[4].c_str()))
{
time_t c_requires_crap = ConvToInt(params[4]) + Instance->Time();
- this->Instance->SNO->WriteToSnoMask('x',"%s Added %cLINE on %s to expire on %s (%s).",prefix.c_str(),*(params[0].c_str()),params[1].c_str(),ctime(&c_requires_crap),params[5].c_str());
+ this->Instance->SNO->WriteToSnoMask('x',"%s Added %cLINE on %s to expire on %s (%s).",prefix.c_str(),*(params[0].c_str()),params[1].c_str(),Instance->TimeString(c_requires_crap).c_str(),params[5].c_str());
}
else
{