Skip to content

Commit 5e5f80d

Browse files
author
田凯夫
committed
Update timer.rs
1 parent a7c82ef commit 5e5f80d

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
@@ -17,12 +17,12 @@ pub fn get_time() -> usize {
1717

1818
/// get current time in milliseconds
1919
pub fn get_time_ms() -> usize {
20-
time::read() / (CLOCK_FREQ / MSEC_PER_SEC)
20+
time::read() * MSEC_PER_SEC / CLOCK_FREQ
2121
}
2222

2323
/// get current time in microseconds
2424
pub fn get_time_us() -> usize {
25-
time::read() / (CLOCK_FREQ / MICRO_PER_SEC)
25+
time::read() * MICRO_PER_SEC / CLOCK_FREQ
2626
}
2727

2828
/// Set the next timer interrupt

0 commit comments

Comments
 (0)