summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/helperfuncs.cpp4
-rw-r--r--src/modules/m_alltime.cpp2
-rw-r--r--src/modules/m_httpd.cpp2
3 files changed, 4 insertions, 4 deletions
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 9ad481bb8..71fb71cdf 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -403,14 +403,14 @@ const char* InspIRCd::Format(const char* formatString, ...)
return ret;
}
-std::string InspIRCd::TimeString(time_t curtime, const char* format)
+std::string InspIRCd::TimeString(time_t curtime, const char* format, bool utc)
{
#ifdef _WIN32
if (curtime < 0)
curtime = 0;
#endif
- struct tm* timeinfo = localtime(&curtime);
+ struct tm* timeinfo = utc ? gmtime(&curtime) : localtime(&curtime);
if (!timeinfo)
{
curtime = 0;
diff --git a/src/modules/m_alltime.cpp b/src/modules/m_alltime.cpp
index ceee4abbc..075064c62 100644
--- a/src/modules/m_alltime.cpp
+++ b/src/modules/m_alltime.cpp
@@ -31,7 +31,7 @@ class CommandAlltime : public Command
CmdResult Handle(const std::vector<std::string> &parameters, User *user)
{
- const std::string fmtdate = InspIRCd::TimeString(ServerInstance->Time(), "%Y-%m-%d %H:%M:%S");
+ const std::string fmtdate = InspIRCd::TimeString(ServerInstance->Time(), "%Y-%m-%d %H:%M:%S", true);
std::string msg = ":" + ServerInstance->Config->ServerName + " NOTICE " + user->nick + " :System time is " + fmtdate + " (" + ConvToStr(ServerInstance->Time()) + ") on " + ServerInstance->Config->ServerName;
diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp
index efd285f8c..bf372f34f 100644
--- a/src/modules/m_httpd.cpp
+++ b/src/modules/m_httpd.cpp
@@ -185,7 +185,7 @@ class HttpServerSocket : public BufferedSocket
WriteData(http_version + " "+ConvToStr(response)+" "+Response(response)+"\r\n");
- rheaders.CreateHeader("Date", InspIRCd::TimeString(ServerInstance->Time(), "%a, %d %b %Y %H:%M:%S GMT"));
+ rheaders.CreateHeader("Date", InspIRCd::TimeString(ServerInstance->Time(), "%a, %d %b %Y %H:%M:%S GMT", true));
rheaders.CreateHeader("Server", INSPIRCD_BRANCH);
rheaders.SetHeader("Content-Length", ConvToStr(size));