Remove dependencies from oldtime::Duration on rest of time crate
This commit is contained in:
parent
5e730ebe4d
commit
6c398ae6f4
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
use std::{fmt, i64};
|
use std::{fmt, i64};
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::ops::{Add, Sub, Mul, Div, Neg, FnOnce};
|
use std::ops::{Add, Sub, Mul, Div, Neg};
|
||||||
use std::time::Duration as StdDuration;
|
use std::time::Duration as StdDuration;
|
||||||
|
|
||||||
/// The number of nanoseconds in a microsecond.
|
/// The number of nanoseconds in a microsecond.
|
||||||
|
@ -131,14 +131,6 @@ impl Duration {
|
||||||
Duration { secs: secs, nanos: nanos as i32 }
|
Duration { secs: secs, nanos: nanos as i32 }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Runs a closure, returning the duration of time it took to run the
|
|
||||||
/// closure.
|
|
||||||
pub fn span<F>(f: F) -> Duration where F: FnOnce() {
|
|
||||||
let before = super::precise_time_ns();
|
|
||||||
f();
|
|
||||||
Duration::nanoseconds((super::precise_time_ns() - before) as i64)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the total number of whole weeks in the duration.
|
/// Returns the total number of whole weeks in the duration.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn num_weeks(&self) -> i64 {
|
pub fn num_weeks(&self) -> i64 {
|
||||||
|
|
Loading…
Reference in New Issue