fix(time):修复了issue #816 (#830)

This commit is contained in:
BrahmaMantra 2024-05-19 23:27:41 +08:00 committed by GitHub
parent f79998f626
commit 975f77a3bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -164,10 +164,8 @@ impl Timekeeper {
#[inline]
fn do_read_cpu_cycle_ns(&self) -> usize {
CurrentTimeArch::cycles2ns(
CurrentTimeArch::get_cycles()
.wrapping_sub(self.last_update_cpu_cycle.load(Ordering::SeqCst)),
)
let prev = self.last_update_cpu_cycle.load(Ordering::SeqCst);
CurrentTimeArch::cycles2ns(CurrentTimeArch::get_cycles().wrapping_sub(prev))
}
fn mark_update_wall_time_ok(&self) {