diff options
author | jackpoz <giacomopoz@gmail.com> | 2013-09-07 17:27:48 +0200 |
---|---|---|
committer | jackpoz <giacomopoz@gmail.com> | 2013-09-07 17:30:23 +0200 |
commit | 67f7c1fde17334570c2266831e52c5027c1eb249 (patch) | |
tree | b96f0efa4b5d20800c014f0e9297642da933ffce /src/server/shared/Utilities/Timer.h | |
parent | 8c70f8cb08d2fc3b38abcac25d421cdd92e25615 (diff) |
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<time_t>::max() / _interval" times.
Fixes https://github.com/TrinityCore/TrinityCore/issues/5816
Diffstat (limited to 'src/server/shared/Utilities/Timer.h')
-rw-r--r-- | src/server/shared/Utilities/Timer.h | 2 |
1 files changed, 1 insertions, 1 deletions
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) |