Skip to content

Commit

Permalink
use wasm compatible instant
Browse files Browse the repository at this point in the history
  • Loading branch information
PSeitz committed Mar 31, 2022
1 parent 39d2e74 commit cd1b207
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ categories = ["development-tools", "development-tools::profiling"]

[dependencies]
log = "0.4"
instant = { version = "0.1", features = [ "stdweb" ] }
4 changes: 1 addition & 3 deletions measure_time_example/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ fn main() {

use std::{thread, time};

let one_sec = time::Duration::from_millis(1000);
let one_sec = time::Duration::from_millis(1002);
thread::sleep(one_sec);

}

5 changes: 2 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub struct MeasureTime {
module_path: &'static str,
file: &'static str,
line: u32,
start: std::time::Instant,
start: instant::Instant,
level: log::LevelFilter,
}
impl MeasureTime {
Expand All @@ -111,7 +111,7 @@ impl MeasureTime {
file,
line,
name: name.into(),
start: std::time::Instant::now(),
start: instant::Instant::now(),
level,
}
}
Expand All @@ -120,7 +120,6 @@ impl MeasureTime {
impl Drop for MeasureTime {
fn drop(&mut self) {
let time = human_readable_time(self.start.elapsed());
//let time = human_readable_time(time_in_ms);

if let Some(level) = self.level.to_level() {
log::logger().log(
Expand Down

0 comments on commit cd1b207

Please sign in to comment.