summaryrefslogtreecommitdiff
path: root/src/inspircd.cpp
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2018-12-04 19:04:09 +0000
committerPeter Powell <petpow@saberuk.com>2018-12-04 19:04:09 +0000
commita4c1b1f4fcfd9cd967bf326afbbada3d91f9da34 (patch)
treea6bd890d53163c6d02b122198e06e2d35d319d43 /src/inspircd.cpp
parentec6955f28ba9423828ac24ef83caee09ffa6b52c (diff)
Add an option for changing the allowed server clock drift.
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r--src/inspircd.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index aa3fb9612..7e299700b 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -644,14 +644,15 @@ void InspIRCd::Run()
}
#endif
- /* Allow a buffer of two seconds drift on this so that ntpdate etc dont harass admins */
- if (TIME.tv_sec < OLDTIME - 2)
+ if (Config->TimeSkipWarn)
{
- SNO->WriteToSnoMask('a', "\002EH?!\002 -- Time is flowing BACKWARDS in this dimension! Clock drifted backwards %lu secs.", (unsigned long)(OLDTIME-TIME.tv_sec));
- }
- else if (TIME.tv_sec > OLDTIME + 2)
- {
- SNO->WriteToSnoMask('a', "\002EH?!\002 -- Time is jumping FORWARDS! Clock skipped %lu secs.", (unsigned long)(TIME.tv_sec - OLDTIME));
+ time_t timediff = TIME.tv_sec - OLDTIME;
+
+ if (timediff > Config->TimeSkipWarn)
+ SNO->WriteToSnoMask('a', "\002Performance warning!\002 Server clock jumped forwards by %lu seconds!", timediff);
+
+ else if (timediff < -Config->TimeSkipWarn)
+ SNO->WriteToSnoMask('a', "\002Performance warning!\002 Server clock jumped backwards by %lu seconds!", labs(timediff));
}
OLDTIME = TIME.tv_sec;