Herald: Use time.monotonic instead of time.time.

To prevent jumping backward and forward on system clock changes.
This commit is contained in:
Valentin Lorentz 2020-07-03 21:00:43 +02:00
parent 9081f5678b
commit 76edd3189c
1 changed files with 2 additions and 2 deletions

View File

@ -97,7 +97,7 @@ class Herald(callbacks.Plugin):
if id in self.splitters:
self.log.debug('Not heralding id #%s, recent split.', id)
return
now = time.time()
now = time.monotonic()
throttle = self.registryValue('throttle',
channel, irc.network)
if now - self.lastHerald.get((channel, id), 0) > throttle:
@ -133,7 +133,7 @@ class Herald(callbacks.Plugin):
id = self._getId(irc, msg.prefix)
except KeyError:
id = msg.nick
self.lastParts[msg.args[0], id] = time.time()
self.lastParts[msg.args[0], id] = time.monotonic()
def _getId(self, irc, userNickHostmask):
try: