Source release 19.1.0
This commit is contained in:
@@ -13,4 +13,12 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef WEAK
|
||||
# if defined(__GNUC__) || defined(__clang__)
|
||||
# define WEAK __attribute__((weak))
|
||||
# else
|
||||
# define WEAK
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif // WVCDM_UTIL_WV_ATTRIBUTES_H_
|
||||
|
||||
@@ -30,7 +30,7 @@ TestSleep::CallBack* TestSleep::callback_ = nullptr;
|
||||
int TestSleep::total_clock_rollback_seconds_ = 0;
|
||||
|
||||
void TestSleep::Sleep(unsigned int seconds) {
|
||||
int64_t milliseconds = 1000 * seconds;
|
||||
int64_t milliseconds = 1000 * static_cast<int64_t>(seconds);
|
||||
if (real_sleep_) {
|
||||
// This next bit of logic is to avoid slow drift apart of the real clock and
|
||||
// the fake clock. We compute how far from the real clock has advanced in
|
||||
@@ -40,7 +40,8 @@ void TestSleep::Sleep(unsigned int seconds) {
|
||||
static const auto start_real = std::chrono::system_clock().now();
|
||||
sleep(seconds);
|
||||
const auto now_real = std::chrono::system_clock().now();
|
||||
const int64_t rollback_adjustment = 1000 * total_clock_rollback_seconds_;
|
||||
const int64_t rollback_adjustment =
|
||||
1000 * static_cast<int64_t>(total_clock_rollback_seconds_);
|
||||
const int64_t total_real =
|
||||
(now_real - start_real) / std::chrono::milliseconds(1) +
|
||||
rollback_adjustment;
|
||||
@@ -129,7 +130,9 @@ bool TestSleep::RollbackSystemTime(int seconds) {
|
||||
// For both real and fake sleep we still update the callback and we still keep
|
||||
// track of the total amount of time slept.
|
||||
total_clock_rollback_seconds_ += seconds;
|
||||
if (callback_ != nullptr) callback_->ElapseTime(-1000 * seconds);
|
||||
if (callback_ != nullptr) {
|
||||
callback_->ElapseTime(-1000 * static_cast<int64_t>(seconds));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user