修复clock_gettime返回类型错误,修复小时间间隔duration返回0问题 (#664)

* 修复clock_gettime返回类型错误,修正wtm初始化逻辑

* 修复duration在小时间间隔下为0的问题

* 临时修复时间流逝速度异常,在test-mount中加入运行时间检测
This commit is contained in:
Donkey Kane
2024-03-25 13:04:32 +08:00
committed by GitHub
parent 401699735b
commit 911132c4b8
3 changed files with 21 additions and 21 deletions

View File

@ -1,7 +1,8 @@
use core::ffi::{c_char, c_void};
use libc::{mount, MS_BIND};
use std::time;
fn main() {
let clock = time::Instant::now();
let source = b"\0".as_ptr() as *const c_char;
let target = b"/mnt/tmp\0".as_ptr() as *const c_char;
let fstype = b"ramfs\0".as_ptr() as *const c_char;
@ -14,4 +15,6 @@ fn main() {
} else {
println!("Mount failed");
}
let dur = clock.elapsed();
println!("mount costing time: {} ns", dur.as_nanos());
}