1
0
Fork 0
forked from AbleOS/ableos
ableos_time/ableos/src/time.rs

18 lines
391 B
Rust
Raw Normal View History

2022-03-11 23:13:41 +00:00
#[cfg(target_arch = "x86_64")]
pub fn fetch_time() -> f64 {
use x86_64::instructions::interrupts::{disable, enable};
disable();
let time = TICK.load(Ordering::Relaxed) as f64;
enable();
time
}
use core::sync::atomic::Ordering;
use kernel::TICK;
#[cfg(target_arch = "riscv64")]
pub fn fetch_time() -> f64 {
let time = TICK.load(Ordering::Relaxed) as f64;
time
}