[android] timer - prevent overflow in due time

This commit is contained in:
Ivo van Dongen
2016-09-09 13:21:41 +02:00
parent 742d6d8275
commit e968f4ed55

View File

@@ -23,8 +23,8 @@ public:
repeat = repeat_;
task = std::move(task_);
due = Clock::now() + timeout;
//Prevent overflows when timeout is set to Duration::max()
due = (timeout == Duration::max()) ? std::chrono::time_point<Clock>::max() : Clock::now() + timeout;
loop->addRunnable(this);
}