From 1fbd75d645e2b4243ebec65bb8952069b24253b9 Mon Sep 17 00:00:00 2001 From: special Date: Sun, 5 Nov 2006 00:47:08 +0000 Subject: Added time syncing! This is fairly simple - servers exchange timestamps and use the lowest - but should get rid of the annoying bounces for those of us who can't depend on ntpd. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5649 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspircd.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/inspircd.cpp') diff --git a/src/inspircd.cpp b/src/inspircd.cpp index dc4986755..cd99e63b6 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -193,6 +193,7 @@ InspIRCd::InspIRCd(int argc, char** argv) this->SNO = new SnomaskManager(this); this->Start(); this->TIME = this->OLDTIME = this->startup_time = time(NULL); + this->time_delta = 0; this->next_call = this->TIME + 3; srand(this->TIME); this->Log(DEBUG,"*** InspIRCd starting up!"); @@ -804,11 +805,21 @@ int InspIRCd::GetModuleCount() return this->ModCount; } -time_t InspIRCd::Time() +time_t InspIRCd::Time(bool delta) { + if (delta) + return TIME + time_delta; return TIME; } +int InspIRCd::SetTimeDelta(int delta) +{ + int old = time_delta; + time_delta += delta; + this->Log(DEBUG, "Time delta set to %d (was %d)", time_delta, old); + return old; +} + bool FileLogger::Readable() { return false; -- cgit v1.3.1-10-gc9f91