1
0
Fork 0
forked from AbleOS/ableos
ableos_time/ableos/src/time.rs
2022-07-29 06:13:26 -05:00

17 lines
374 B
Rust

use core::sync::atomic::Ordering;
use kernel::TICK;
#[cfg(target_arch = "x86_64")]
pub fn fetch_time() -> f64 {
let time = x86_64::instructions::interrupts::without_interrupts(|| {
TICK.load(Ordering::Relaxed) as f64
});
time
}
#[cfg(target_arch = "riscv64")]
pub fn fetch_time() -> f64 {
let time = TICK.load(Ordering::Relaxed) as f64;
time
}