Skip to content

Commit c08034d

Browse files
authored
Rollup merge of rust-lang#76958 - est31:ns, r=oli-obk
Replace manual as_nanos and as_secs_f64 reimplementations
2 parents 22944a8 + af7498e commit c08034d

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

test/src/bench.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@ fn fmt_thousands_sep(mut n: usize, sep: char) -> String {
9898
output
9999
}
100100

101-
fn ns_from_dur(dur: Duration) -> u64 {
102-
dur.as_secs() * 1_000_000_000 + (dur.subsec_nanos() as u64)
103-
}
104-
105101
fn ns_iter_inner<T, F>(inner: &mut F, k: u64) -> u64
106102
where
107103
F: FnMut() -> T,
@@ -110,7 +106,7 @@ where
110106
for _ in 0..k {
111107
black_box(inner());
112108
}
113-
ns_from_dur(start.elapsed())
109+
start.elapsed().as_nanos() as u64
114110
}
115111

116112
pub fn iter<T, F>(inner: &mut F) -> stats::Summary

0 commit comments

Comments
 (0)