[IE][VPU]: Fixed the calculation of timeout for x32 system (#3842)

This commit is contained in:
Nikita Kudriavtsev 2021-01-15 12:17:28 +03:00 committed by GitHub
parent e9a52d39ac
commit 5d63b5f41f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -61,7 +61,7 @@ class PThreadBinSemaphoreTest : public ::testing::TestWithParam<int>{
std::cerr << "clock_gettime";
}
auto newNsec = (long)(spec.tv_nsec + timeout * 1000000000L);
auto newNsec = static_cast<long long>(spec.tv_nsec + timeout * 1000000000LL);
spec.tv_sec += newNsec / 1000000000L;
spec.tv_nsec = newNsec % 1000000000L;

View File

@ -239,8 +239,9 @@ void WatchdogImpl::waitFor(const milliseconds sleepInterval) {
#else
clock_gettime(CLOCK_MONOTONIC, &timeToWait);
const auto secondInNanoSeconds = 1000000000L;
const auto nsecSum = std::chrono::duration_cast<std::chrono::nanoseconds>(sleepInterval).count() -
std::chrono::nanoseconds(sec).count() + timeToWait.tv_nsec;
const auto nsecSum = static_cast<long long>(
std::chrono::duration_cast<std::chrono::nanoseconds>(sleepInterval).count() -
std::chrono::nanoseconds(sec).count() + timeToWait.tv_nsec);
timeToWait.tv_sec += sec.count() + nsecSum / secondInNanoSeconds;
timeToWait.tv_nsec = nsecSum % secondInNanoSeconds;
#endif // (defined(__APPLE__) || defined(_WIN32))