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:
Dominic Hamon 2016-05-11 09:06:55 -07:00
commit 539da11250
2 changed files with 6 additions and 8 deletions

View file

@ -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 =

View file

@ -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)
);
}
}