From c48e4a687086a9f8a7311f97264c981d35300485 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Fri, 7 Aug 2009 01:53:34 +0000 Subject: When setting up the next fire time for a Timer make sure it can't be in the past. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@801857 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/Timer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'qpid/cpp/src') diff --git a/qpid/cpp/src/qpid/sys/Timer.cpp b/qpid/cpp/src/qpid/sys/Timer.cpp index 08c6b6bd9f..4a3eef3a2d 100644 --- a/qpid/cpp/src/qpid/sys/Timer.cpp +++ b/qpid/cpp/src/qpid/sys/Timer.cpp @@ -55,9 +55,10 @@ void TimerTask::fireTask() { fire(); } +// This can only be used to setup the next fire time. After the Timer has already fired void TimerTask::setupNextFire() { if (period && readyToFire()) { - nextFireTime = AbsTime(nextFireTime, period); + nextFireTime = max(AbsTime::now(), AbsTime(nextFireTime, period)); cancelled = false; } else { QPID_LOG(error, "Couldn't setup next timer firing: " << Duration(nextFireTime, AbsTime::now()) << "[" << period << "]"); -- cgit v1.2.1