Skip to content

Commit befccb2

Browse files
author
田凯夫
committed
Update timer.rs
1 parent 01d411e commit befccb2

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
@@ -19,13 +19,13 @@ pub fn get_time() -> usize {
1919
/// get current time in milliseconds
2020
#[allow(dead_code)]
2121
pub fn get_time_ms() -> usize {
22-
time::read() / (CLOCK_FREQ / MSEC_PER_SEC)
22+
time::read() * MSEC_PER_SEC / CLOCK_FREQ
2323
}
2424

2525
/// get current time in microseconds
2626
#[allow(dead_code)]
2727
pub fn get_time_us() -> usize {
28-
time::read() / (CLOCK_FREQ / MICRO_PER_SEC)
28+
time::read() * MICRO_PER_SEC / CLOCK_FREQ
2929
}
3030

3131
/// Set the next timer interrupt

0 commit comments

Comments
 (0)