Merge "Prevent WaitForProperty() from using ~100% of CPU time on 32bit builds"
am: 7c6b024241
Change-Id: I08851adfbb9a4fa01a65ca1af6a7c41d0643ca1d
This commit is contained in:
commit
b94bff1d64
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
|
||||
#include <android-base/parseint.h>
|
||||
|
@ -109,7 +110,7 @@ static void WaitForPropertyCallback(void* data_ptr, const char*, const char* val
|
|||
static void DurationToTimeSpec(timespec& ts, const std::chrono::milliseconds d) {
|
||||
auto s = std::chrono::duration_cast<std::chrono::seconds>(d);
|
||||
auto ns = std::chrono::duration_cast<std::chrono::nanoseconds>(d - s);
|
||||
ts.tv_sec = s.count();
|
||||
ts.tv_sec = std::min<std::chrono::seconds::rep>(s.count(), std::numeric_limits<time_t>::max());
|
||||
ts.tv_nsec = ns.count();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue