Skip to content

Commit 37bf4bf

Browse files
author
田凯夫
committed
Update timer.rs
1 parent 14c0c0b commit 37bf4bf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

os/src/timer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ pub fn get_time() -> usize {
2525

2626
/// Get the current time in milliseconds
2727
pub fn get_time_ms() -> usize {
28-
time::read() / (CLOCK_FREQ / MSEC_PER_SEC)
28+
time::read() * MSEC_PER_SEC / CLOCK_FREQ
2929
}
3030

3131
/// get current time in microseconds
3232
pub fn get_time_us() -> usize {
33-
time::read() / (CLOCK_FREQ / MICRO_PER_SEC)
33+
time::read() * MICRO_PER_SEC / CLOCK_FREQ
3434
}
3535

3636
/// Set the next timer interrupt

0 commit comments

Comments
 (0)