Skip to content

Commit

Permalink
Fix get_time
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf2019 committed Feb 28, 2024
1 parent 39c3284 commit 3f99b74
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ pub fn yield_() -> isize {
}

pub fn get_time() -> isize {
let time = TimeVal::new();
match sys_get_time(&time, 0) {
let mut time = TimeVal::new();
match sys_get_time(&mut time, 0) {
0 => ((time.sec & 0xffff) * 1000 + time.usec / 1000) as isize,
_ => -1,
}
Expand Down
2 changes: 1 addition & 1 deletion src/syscall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ pub fn sys_yield() -> isize {
syscall(SYSCALL_YIELD, [0, 0, 0])
}

pub fn sys_get_time(time: &TimeVal, tz: usize) -> isize {
pub fn sys_get_time(time: &mut TimeVal, tz: usize) -> isize {
syscall(SYSCALL_GETTIMEOFDAY, [time as *const _ as usize, tz, 0])
}

Expand Down

0 comments on commit 3f99b74

Please sign in to comment.