From 67f7c1fde17334570c2266831e52c5027c1eb249 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sat, 7 Sep 2013 17:27:48 +0200 Subject: Core/Timer: Better handle system clock changes Change IntervalTimer::Reset() behavior to handle system clock changes forward and backward. This fixes IntervalTimer:.Passed() returning true till it catches up to the new time, triggering the event up to "std::numeric_limits::max() / _interval" times. Fixes https://github.com/TrinityCore/TrinityCore/issues/5816 --- src/server/shared/Utilities/Timer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/server/shared/Utilities/Timer.h') diff --git a/src/server/shared/Utilities/Timer.h b/src/server/shared/Utilities/Timer.h index 5bc19a2b779..b0b395865b4 100644 --- a/src/server/shared/Utilities/Timer.h +++ b/src/server/shared/Utilities/Timer.h @@ -66,7 +66,7 @@ struct IntervalTimer void Reset() { if (_current >= _interval) - _current -= _interval; + _current %= _interval; } void SetCurrent(time_t current) -- cgit v1.2.3