From 999bdeca88a06938ac1e1c608091d3afe4d7e173 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sun, 5 Jul 2015 23:20:00 -0700 Subject: Stabilize the Duration API This commit stabilizes the `std::time` module and the `Duration` type. `Duration::span` remains unstable, and the `Display` implementation for `Duration` has been removed as it is still being reworked and all trait implementations for stable types are de facto stable. This is a [breaking-change] to those using `Duration`'s `Display` implementation. --- src/libstd/sys/windows/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/libstd/sys/windows') diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs index b6d080109df..b38945d8916 100644 --- a/src/libstd/sys/windows/mod.rs +++ b/src/libstd/sys/windows/mod.rs @@ -162,10 +162,10 @@ fn dur2timeout(dur: Duration) -> libc::DWORD { // * Nanosecond precision is rounded up // * Greater than u32::MAX milliseconds (50 days) is rounded up to INFINITE // (never time out). - dur.secs().checked_mul(1000).and_then(|ms| { - ms.checked_add((dur.extra_nanos() as u64) / 1_000_000) + dur.as_secs().checked_mul(1000).and_then(|ms| { + ms.checked_add((dur.subsec_nanos() as u64) / 1_000_000) }).and_then(|ms| { - ms.checked_add(if dur.extra_nanos() % 1_000_000 > 0 {1} else {0}) + ms.checked_add(if dur.subsec_nanos() % 1_000_000 > 0 {1} else {0}) }).map(|ms| { if ms > ::max_value() as u64 { libc::INFINITE -- cgit 1.4.1-3-g733a5