Fix time direction in case of unexpected ntp-like intervention,
@@ -20,6 +20,7 @@ namespace {
}
static double EstimateCPUClock() {
+ for (;;) {
ui64 startCycle = 0;
ui64 startMS = 0;
@@ -54,9 +55,11 @@ namespace {
break;
}
}
-
+ if (startMS < finishMS && startCycle < finishCycle) {
return (finishCycle - startCycle) * 1000000.0 / (finishMS - startMS);
}
+ }
+ }
static double InitHPTimer() {
const size_t N_VEC = 9;
