Merge pull request #7791 from german77/wall_clock

wall_clock: Use standard wall clock if rtsc frequency is too low
master
Morph 2022-01-28 20:04:24 +07:00 committed by GitHub
commit 11099dda2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

@ -72,7 +72,9 @@ std::unique_ptr<WallClock> CreateBestMatchingClock(u32 emulated_cpu_frequency,
if (caps.invariant_tsc) { if (caps.invariant_tsc) {
rtsc_frequency = EstimateRDTSCFrequency(); rtsc_frequency = EstimateRDTSCFrequency();
} }
if (rtsc_frequency == 0) {
// Fallback to StandardWallClock if rtsc period is higher than a nano second
if (rtsc_frequency <= 1000000000) {
return std::make_unique<StandardWallClock>(emulated_cpu_frequency, return std::make_unique<StandardWallClock>(emulated_cpu_frequency,
emulated_clock_frequency); emulated_clock_frequency);
} else { } else {