summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Network/DummyTimerFactory.cpp')
-rw-r--r--Swiften/Network/DummyTimerFactory.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/Swiften/Network/DummyTimerFactory.cpp b/Swiften/Network/DummyTimerFactory.cpp
index 72523bb..7626584 100644
--- a/Swiften/Network/DummyTimerFactory.cpp
+++ b/Swiften/Network/DummyTimerFactory.cpp
@@ -2,8 +2,8 @@
#include <algorithm>
-#include "Swiften/Network/Timer.h"
#include "Swiften/Base/foreach.h"
+#include "Swiften/Network/Timer.h"
namespace Swift {
@@ -40,7 +40,7 @@ static bool hasZeroTimeout(boost::shared_ptr<DummyTimerFactory::DummyTimer> time
void DummyTimerFactory::setTime(int time) {
assert(time > currentTime);
- int increment = currentTime - time;
+ int increment = time - currentTime;
std::vector< boost::shared_ptr<DummyTimer> > notifyTimers(timers.begin(), timers.end());
foreach(boost::shared_ptr<DummyTimer> timer, notifyTimers) {
if (increment >= timer->timeout) {
@@ -49,6 +49,9 @@ void DummyTimerFactory::setTime(int time) {
}
timer->timeout = 0;
}
+ else {
+ timer->timeout -= increment;
+ }
}
timers.erase(std::remove_if(timers.begin(), timers.end(), hasZeroTimeout), timers.end());
currentTime = time;