diff options
| author | bors <bors@rust-lang.org> | 2014-08-13 23:11:28 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-08-13 23:11:28 +0000 |
| commit | 28b5e4588f5d78d2dab830245bc453dd666af617 (patch) | |
| tree | 72a65cb6a11a37106bc302c2035e7d38e854f82a /src/libsync | |
| parent | 0f09f51c61f1671caa75e9797f081ab4e312b634 (diff) | |
| parent | 075256a0701e23ce56e9c09206d6c8f581c46115 (diff) | |
| download | rust-28b5e4588f5d78d2dab830245bc453dd666af617.tar.gz rust-28b5e4588f5d78d2dab830245bc453dd666af617.zip | |
auto merge of #15934 : brson/rust/dur, r=aturon
Currently, the Timer methods take an integer number of ms. This is considered a bug because a) types, b) some timers have ns precision. This plucks the `Duration` type from [rust-chrono](https://github.com/lifthrasiir/rust-chrono), plops it into `std::time`, and replaces the arguments to `sleep`, `oneshot`, and `periodic` timers with it. It leaves the old methods intact as `sleep_ms`, `oneshot_ms`, and `periodic_ms`, for convenience. Closes https://github.com/rust-lang/rust/issues/11189. cc @lifthrasiir @aturon @kballard @alexcrichton
Diffstat (limited to 'src/libsync')
| -rw-r--r-- | src/libsync/comm/mod.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libsync/comm/mod.rs b/src/libsync/comm/mod.rs index 45016b97566..e4df661b562 100644 --- a/src/libsync/comm/mod.rs +++ b/src/libsync/comm/mod.rs @@ -128,10 +128,11 @@ //! //! ```no_run //! use std::io::timer::Timer; +//! use std::time::Duration; //! //! let (tx, rx) = channel::<int>(); //! let mut timer = Timer::new().unwrap(); -//! let timeout = timer.oneshot(10000); +//! let timeout = timer.oneshot(Duration::seconds(10)); //! //! loop { //! select! { @@ -150,12 +151,13 @@ //! //! ```no_run //! use std::io::timer::Timer; +//! use std::time::Duration; //! //! let (tx, rx) = channel::<int>(); //! let mut timer = Timer::new().unwrap(); //! //! loop { -//! let timeout = timer.oneshot(5000); +//! let timeout = timer.oneshot(Duration::seconds(5)); //! //! select! { //! val = rx.recv() => println!("Received {}", val), |
