mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 14:06:33 +00:00
posix: Use trunc() from <math.h> 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 <jperaza@chromium.org>
This commit is contained in:
parent
d2d10d1dc8
commit
7819ecbed6
@ -15,10 +15,9 @@
|
||||
#include "util/synchronization/semaphore.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user