mirror of https://gitee.com/bigwinds/arangodb
fix buffer overflow (#8187)
This commit is contained in:
parent
8ce55e548f
commit
7c091c57d0
|
@ -966,8 +966,11 @@ uint64_t WinEnvIO::NowNanos() {
|
|||
QueryPerformanceCounter(&li);
|
||||
// Convert to nanoseconds first to avoid loss of precision
|
||||
// and divide by frequency
|
||||
li.QuadPart *= std::nano::den;
|
||||
li.QuadPart /= perf_counter_frequency_;
|
||||
if (perf_counter_frequency_ < std::nano::den) {
|
||||
li.QuadPart *= (std::nano::den / perf_counter_frequency_);
|
||||
} else {
|
||||
li.QuadPart /= (perf_counter_frequency_ / std::nano::den);
|
||||
} // else
|
||||
return li.QuadPart;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue