From 7819ecbed662061eadd60c543dafe54cd32930ca Mon Sep 17 00:00:00 2001 From: Mark Mentovai Date: Thu, 22 Jun 2017 16:46:26 -0400 Subject: [PATCH] posix: Use trunc() from instead of std::trunc() This folow-up to d2d10d1dc8f3 is for compatibility with 32-bit Android platforms using NDK API 16. isinf() is also caught up in the switch. Change-Id: I652e27061c01afa3dd932f494cc4eeaca4236f40 Reviewed-on: https://chromium-review.googlesource.com/544238 Reviewed-by: Joshua Peraza --- util/synchronization/semaphore_posix.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/util/synchronization/semaphore_posix.cc b/util/synchronization/semaphore_posix.cc index 0dd8c26e..f6e8bea1 100644 --- a/util/synchronization/semaphore_posix.cc +++ b/util/synchronization/semaphore_posix.cc @@ -15,10 +15,9 @@ #include "util/synchronization/semaphore.h" #include +#include #include -#include - #include "base/logging.h" #include "base/posix/eintr_wrapper.h" @@ -54,7 +53,7 @@ void Semaphore::Wait() { bool Semaphore::TimedWait(double seconds) { DCHECK_GE(seconds, 0.0); - if (std::isinf(seconds)) { + if (isinf(seconds)) { Wait(); return true; } @@ -66,7 +65,7 @@ bool Semaphore::TimedWait(double seconds) { } timespec timeout; timeout.tv_sec = seconds; - timeout.tv_nsec = (seconds - std::trunc(seconds)) * 1E9; + timeout.tv_nsec = (seconds - trunc(seconds)) * 1E9; AddTimespec(current_time, timeout, &timeout); int rv = HANDLE_EINTR(sem_timedwait(&semaphore_, &timeout));