summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/inspircd.h5
-rw-r--r--src/inspircd.cpp5
-rw-r--r--src/modules/m_alltime.cpp3
3 files changed, 11 insertions, 2 deletions
diff --git a/include/inspircd.h b/include/inspircd.h
index 7fecf22ae..d0806a381 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -449,6 +449,11 @@ class InspIRCd : public classbase
*/
int SetTimeDelta(int delta);
+ /** Get the time offset in seconds
+ * @return The current time delta (in seconds)
+ */
+ int GetTimeDelta();
+
/** Process a user whos socket has been flagged as active
* @param cu The user to process
* @return There is no actual return value, however upon exit, the user 'cu' may have been deleted
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index bd5af2752..12134f3f6 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -830,6 +830,11 @@ int InspIRCd::SetTimeDelta(int delta)
return old;
}
+int InspIRCd::GetTimeDelta()
+{
+ return time_delta;
+}
+
bool FileLogger::Readable()
{
return false;
diff --git a/src/modules/m_alltime.cpp b/src/modules/m_alltime.cpp
index 0ce517886..d207d457e 100644
--- a/src/modules/m_alltime.cpp
+++ b/src/modules/m_alltime.cpp
@@ -24,8 +24,7 @@ class cmd_alltime : public command_t
time_t now = ServerInstance->Time();
strftime(fmtdate, sizeof(fmtdate), "%F %T", gmtime(&now));
- // I'm too lazy to add a function to fetch the delta, so lets just cheat..
- int delta = time(NULL) - now;
+ int delta = ServerInstance->GetTimeDelta();
string msg = ":" + string(ServerInstance->Config->ServerName) + " NOTICE " + user->nick + " :Time for " +
ServerInstance->Config->ServerName + " is: " + fmtdate + " (delta " + ConvToStr(delta) + " seconds)";