--- a/borgend/scheduler.py Tue Feb 06 20:55:53 2018 +0000 +++ b/borgend/scheduler.py Wed Feb 07 20:39:01 2018 +0000 @@ -154,28 +154,26 @@ with self._cond: while not self._terminate: snapshot = dreamtime.Snapshot() - now = snapshot.monotonic() if not self._list: timeout = None - delta = None + delta = math.inf nextname = None else: nextname=self._list.name - delta = self._list.when.horizon(snapshot)-now + delta = self._list.when.horizon(snapshot) if delta==math.inf: timeout=None else: timeout = min(self.precision, delta) if not timeout or timeout>0: - logger.debug("Scheduler waiting %s seconds [next event '%s' in %s seconds]" - % (str(timeout), nextname, str(delta))) + logger.debug("Scheduler waiting %s seconds [next event '%s' in %0.2f seconds]" + % (str(timeout), nextname, delta)) self._cond.wait(timeout) snapshot = dreamtime.Snapshot() - now = snapshot.monotonic() logger.debug("Scheduler timed out") - while self._list and self._list.when.horizon(snapshot) <= now: + while self._list and self._list.when.horizon(snapshot) <= 0: ev=self._list logger.debug("Scheduler activating %s" % (ev.name or "(unknown)")) # We are only allowed to remove ev from list when ev.cond allows @@ -217,7 +215,7 @@ # cond has to be acquired on entry! def wait_until(self, when, cond, name=None): logger.info("Scheduling '%s' in %0.01f seconds / on %s [%s]" % - (name, when.seconds_to(), when.isoformat(), + (name, when.remaining(), when.isoformat(), when.__class__.__name__)) self._wait(ScheduledEvent(when, cond, name))