[android] timer - prevent overflow in due time
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user