Remove dependencies from oldtime::Duration on rest of time crate

This commit is contained in:
Jethro Beekman 2017-02-24 15:19:48 -08:00
parent 5e730ebe4d
commit 6c398ae6f4
1 changed files with 1 additions and 9 deletions

View File

@ -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 {