mirror of
https://github.com/google/benchmark.git
synced 2024-11-26 07:32:19 +00:00
Merge pull request #209 from BillyONeal/fix-appveyor
Fix appveyor's older MSVC++ builds by working around 2015 Update 2 bugfix
This commit is contained in:
commit
539da11250
|
@ -186,7 +186,8 @@ static void BM_ManualTiming(benchmark::State& state) {
|
|||
while (state.KeepRunning()) {
|
||||
auto start = std::chrono::high_resolution_clock::now();
|
||||
// Simulate some useful workload with a sleep
|
||||
std::this_thread::sleep_for(sleep_duration);
|
||||
std::this_thread::sleep_for(std::chrono::duration_cast<
|
||||
std::chrono::nanoseconds>(sleep_duration));
|
||||
auto end = std::chrono::high_resolution_clock::now();
|
||||
|
||||
auto elapsed =
|
||||
|
|
|
@ -9,14 +9,11 @@ void BM_basic(benchmark::State& state) {
|
|||
}
|
||||
|
||||
void BM_basic_slow(benchmark::State& state) {
|
||||
|
||||
int milliseconds = state.range_x();
|
||||
std::chrono::duration<double, std::milli> sleep_duration {
|
||||
static_cast<double>(milliseconds)
|
||||
};
|
||||
|
||||
std::chrono::milliseconds sleep_duration(state.range_x());
|
||||
while (state.KeepRunning()) {
|
||||
std::this_thread::sleep_for(sleep_duration);
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::duration_cast<std::chrono::nanoseconds>(sleep_duration)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue