Skip to content

Commit fbc73e1

Browse files
committed
---
yaml --- r: 128210 b: refs/heads/try c: a391934 h: refs/heads/master v: v3
1 parent 079d8fa commit fbc73e1

File tree

10 files changed

+36
-20
lines changed

10 files changed

+36
-20
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: cb9c1e0e702f4a1a5dfc909b15b74e8556013c06
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: aa98b25c4f0c10729dff37c699904ad57b8fbda8
5-
refs/heads/try: 80d32438d665ae74ffb1bc5ad60f7329ed17f39a
5+
refs/heads/try: a391934ba8fb99b999f9956e855316692612f1ab
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libgreen/sched.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,7 @@ mod test {
10291029
use std::rt::task::TaskOpts;
10301030
use std::rt::task::Task;
10311031
use std::rt::local::Local;
1032+
use std::time::Duration;
10321033

10331034
use {TaskState, PoolConfig, SchedPool};
10341035
use basic;
@@ -1291,7 +1292,7 @@ mod test {
12911292
// doesn't exit before emptying the work queue
12921293
pool.spawn(TaskOpts::new(), proc() {
12931294
spawn(proc() {
1294-
timer::sleep(10);
1295+
timer::sleep(Duration::milliseconds(10));
12951296
});
12961297
});
12971298

branches/try/src/libstd/io/net/tcp.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,14 @@ impl TcpStream {
171171
/// # #![allow(unused_must_use)]
172172
/// use std::io::timer;
173173
/// use std::io::TcpStream;
174+
/// use std::time::Duration;
174175
///
175176
/// let mut stream = TcpStream::connect("127.0.0.1", 34254).unwrap();
176177
/// let stream2 = stream.clone();
177178
///
178179
/// spawn(proc() {
179180
/// // close this stream after one second
180-
/// timer::sleep(1000);
181+
/// timer::sleep(Duration::seconds(1));
181182
/// let mut stream = stream2;
182183
/// stream.close_read();
183184
/// });

branches/try/src/libstd/io/timer.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,16 @@ use rt::rtio::{IoFactory, LocalIo, RtioTimer, Callback};
3838
/// # fn main() {}
3939
/// # fn foo() {
4040
/// use std::io::Timer;
41+
/// use std::time::Duration;
4142
///
4243
/// let mut timer = Timer::new().unwrap();
43-
/// timer.sleep(10); // block the task for awhile
44+
/// timer.sleep(Duration::milliseconds(10)); // block the task for awhile
4445
///
45-
/// let timeout = timer.oneshot(10);
46+
/// let timeout = timer.oneshot(Duration::milliseconds(10));
4647
/// // do some work
4748
/// timeout.recv(); // wait for the timeout to expire
4849
///
49-
/// let periodic = timer.periodic(10);
50+
/// let periodic = timer.periodic(Duration::milliseconds(10));
5051
/// loop {
5152
/// periodic.recv();
5253
/// // this loop is only executed once every 10ms
@@ -61,9 +62,10 @@ use rt::rtio::{IoFactory, LocalIo, RtioTimer, Callback};
6162
/// # fn main() {}
6263
/// # fn foo() {
6364
/// use std::io::timer;
65+
/// use std::time::Duration;
6466
///
6567
/// // Put this task to sleep for 5 seconds
66-
/// timer::sleep(5000);
68+
/// timer::sleep(Duration::seconds(5));
6769
/// # }
6870
/// ```
6971
pub struct Timer {
@@ -123,9 +125,10 @@ impl Timer {
123125
///
124126
/// ```rust
125127
/// use std::io::Timer;
128+
/// use std::time::Duration;
126129
///
127130
/// let mut timer = Timer::new().unwrap();
128-
/// let ten_milliseconds = timer.oneshot(10);
131+
/// let ten_milliseconds = timer.oneshot(Duration::milliseconds(10));
129132
///
130133
/// for _ in range(0u, 100) { /* do work */ }
131134
///
@@ -135,9 +138,10 @@ impl Timer {
135138
///
136139
/// ```rust
137140
/// use std::io::Timer;
141+
/// use std::time::Duration;
138142
///
139143
/// // Incorrect, method chaining-style:
140-
/// let mut five_ms = Timer::new().unwrap().oneshot(5);
144+
/// let mut five_ms = Timer::new().unwrap().oneshot(Duration::milliseconds(5));
141145
/// // The timer object was destroyed, so this will always fail:
142146
/// // five_ms.recv()
143147
/// ```
@@ -173,9 +177,10 @@ impl Timer {
173177
///
174178
/// ```rust
175179
/// use std::io::Timer;
180+
/// use std::time::Duration;
176181
///
177182
/// let mut timer = Timer::new().unwrap();
178-
/// let ten_milliseconds = timer.periodic(10);
183+
/// let ten_milliseconds = timer.periodic(Duration::milliseconds(10));
179184
///
180185
/// for _ in range(0u, 100) { /* do work */ }
181186
///
@@ -191,9 +196,10 @@ impl Timer {
191196
///
192197
/// ```rust
193198
/// use std::io::Timer;
199+
/// use std::time::Duration;
194200
///
195201
/// // Incorrect, method chaining-style.
196-
/// let mut five_ms = Timer::new().unwrap().periodic(5);
202+
/// let mut five_ms = Timer::new().unwrap().periodic(Duration::milliseconds(5));
197203
/// // The timer object was destroyed, so this will always fail:
198204
/// // five_ms.recv()
199205
/// ```

branches/try/src/libsync/comm/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,11 @@
128128
//!
129129
//! ```no_run
130130
//! use std::io::timer::Timer;
131+
//! use std::time::Duration;
131132
//!
132133
//! let (tx, rx) = channel::<int>();
133134
//! let mut timer = Timer::new().unwrap();
134-
//! let timeout = timer.oneshot(10000);
135+
//! let timeout = timer.oneshot(Duration::seconds(10));
135136
//!
136137
//! loop {
137138
//! select! {
@@ -150,12 +151,13 @@
150151
//!
151152
//! ```no_run
152153
//! use std::io::timer::Timer;
154+
//! use std::time::Duration;
153155
//!
154156
//! let (tx, rx) = channel::<int>();
155157
//! let mut timer = Timer::new().unwrap();
156158
//!
157159
//! loop {
158-
//! let timeout = timer.oneshot(5000);
160+
//! let timeout = timer.oneshot(Duration::seconds(5));
159161
//!
160162
//! select! {
161163
//! val = rx.recv() => println!("Received {}", val),

branches/try/src/test/run-pass/core-run-destroy.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ extern crate green;
2525
extern crate rustuv;
2626

2727
use std::io::{Process, Command};
28+
use std::time::Duration;
2829

2930
macro_rules! succeed( ($e:expr) => (
3031
match $e { Ok(..) => {}, Err(e) => fail!("failure: {}", e) }
@@ -115,7 +116,7 @@ pub fn test_destroy_actually_kills(force: bool) {
115116
// Don't let this test time out, this should be quick
116117
let (tx, rx1) = channel();
117118
let mut t = timer::Timer::new().unwrap();
118-
let rx2 = t.oneshot(1000);
119+
let rx2 = t.oneshot(Duration::milliseconds(1000));
119120
spawn(proc() {
120121
select! {
121122
() = rx2.recv() => unsafe { libc::exit(1) },

branches/try/src/test/run-pass/issue-12684.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ extern crate native;
1313
extern crate green;
1414
extern crate rustuv;
1515

16+
use std::time::Duration;
17+
1618
#[start]
1719
fn start(argc: int, argv: *const *const u8) -> int {
1820
green::start(argc, argv, rustuv::event_loop, main)
@@ -24,6 +26,6 @@ fn main() {
2426

2527
fn customtask() {
2628
let mut timer = std::io::timer::Timer::new().unwrap();
27-
let periodic = timer.periodic(10);
29+
let periodic = timer.periodic(Duration::milliseconds(10));
2830
periodic.recv();
2931
}

branches/try/src/test/run-pass/issue-12699.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212
extern crate native;
1313

1414
use std::io::timer;
15+
use std::time::Duration;
1516

1617
#[start]
1718
fn start(argc: int, argv: *const *const u8) -> int {
1819
native::start(argc, argv, main)
1920
}
2021

2122
fn main() {
22-
timer::sleep(250);
23+
timer::sleep(Duration::milliseconds(250));
2324
}

branches/try/src/test/run-pass/issue-9396.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@
1010

1111
use std::comm;
1212
use std::io::timer::Timer;
13+
use std::time::Duration;
1314

1415
pub fn main() {
1516
let (tx, rx) = channel();
1617
spawn(proc (){
1718
let mut timer = Timer::new().unwrap();
18-
timer.sleep(10);
19+
timer.sleep(Duration::milliseconds(10));
1920
tx.send(());
2021
});
2122
loop {

branches/try/src/test/run-pass/tcp-connect-timeouts.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ macro_rules! iotest (
3838
use std::io::net::tcp::*;
3939
use std::io::test::*;
4040
use std::io;
41+
use std::time::Duration;
4142

4243
fn f() $b
4344

@@ -72,7 +73,7 @@ iotest!(fn eventual_timeout() {
7273

7374
let mut v = Vec::new();
7475
for _ in range(0u, 10000) {
75-
match TcpStream::connect_timeout(addr, 100) {
76+
match TcpStream::connect_timeout(addr, Duration::milliseconds(100)) {
7677
Ok(e) => v.push(e),
7778
Err(ref e) if e.kind == io::TimedOut => return,
7879
Err(e) => fail!("other error: {}", e),
@@ -87,11 +88,11 @@ iotest!(fn timeout_success() {
8788
let port = addr.port;
8889
let _l = TcpListener::bind(host.as_slice(), port).unwrap().listen();
8990

90-
assert!(TcpStream::connect_timeout(addr, 1000).is_ok());
91+
assert!(TcpStream::connect_timeout(addr, Duration::milliseconds(1000)).is_ok());
9192
})
9293

9394
iotest!(fn timeout_error() {
9495
let addr = next_test_ip4();
9596

96-
assert!(TcpStream::connect_timeout(addr, 1000).is_err());
97+
assert!(TcpStream::connect_timeout(addr, Duration::milliseconds(1000)).is_err());
9798
})

0 commit comments

Comments
 (0)