Skip to content

Commit 7a8e057

Browse files
committed
chore(histogram): Simplify code by using std lib method
Leverage existing standard library method to simplify implementation. No changes to public API or MSRV. Signed-off-by: Matheus <[email protected]>
1 parent e07efb4 commit 7a8e057

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/histogram.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,8 +884,7 @@ pub fn exponential_buckets(start: f64, factor: f64, count: usize) -> Result<Vec<
884884
/// `duration_to_seconds` converts Duration to seconds.
885885
#[inline]
886886
pub fn duration_to_seconds(d: Duration) -> f64 {
887-
let nanos = f64::from(d.subsec_nanos()) / 1e9;
888-
d.as_secs() as f64 + nanos
887+
d.as_secs_f64()
889888
}
890889

891890
#[derive(Clone, Debug)]

0 commit comments

Comments
 (0)