From e968f4ed55c194b73d8d10e3c3846e9798c8693d Mon Sep 17 00:00:00 2001 From: Ivo van Dongen Date: Fri, 9 Sep 2016 13:21:41 +0200 Subject: [PATCH] [android] timer - prevent overflow in due time --- platform/android/src/timer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/android/src/timer.cpp b/platform/android/src/timer.cpp index 7057d6de7..2eb003b2b 100644 --- a/platform/android/src/timer.cpp +++ b/platform/android/src/timer.cpp @@ -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::max() : Clock::now() + timeout; loop->addRunnable(this); }