Skip to content

Commit d4cd4d4

Browse files
author
bors-servo
authored
Auto merge of #213 - spk:remove-crate-time, r=SimonSapin
Use std::time instead of deprecated crate time Crate time is deprecated; switch to `std::time` Cheers <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/html5ever/213) <!-- Reviewable:end -->
2 parents 6afdb4e + c377068 commit d4cd4d4

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ heap_size = ["heapsize", "heapsize_plugin"]
3636
codegen = ["html5ever_macros"]
3737

3838
[dependencies]
39-
time = "0"
4039
log = "0"
4140
phf = "0.7"
4241
string_cache = "0.2.0"

src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ extern crate mac;
2929

3030
extern crate phf;
3131

32-
extern crate time;
33-
3432
pub use tokenizer::Attribute;
3533
pub use driver::{ParseOpts, parse_document, parse_fragment, Parser};
3634

src/macros.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ macro_rules! unwrap_or_return {
2424

2525
macro_rules! time {
2626
($e:expr) => {{
27-
let t0 = ::time::precise_time_ns();
27+
let now = ::std::time::Instant::now();
2828
let result = $e;
29-
let dt = ::time::precise_time_ns() - t0;
29+
let d = now.elapsed();
30+
let dt = d.as_secs() * 1_000_000_000 + u64::from(d.subsec_nanos());
3031
(result, dt)
3132
}}
3233
}

0 commit comments

Comments
 (0)