Skip to content

Commit 6ec079e

Browse files
authored
Use Duration::MAX (#137)
Replaces the old `duration_max()` hack
1 parent 092d458 commit 6ec079e

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/lib.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,6 @@ pub mod os;
9393
pub use driver::block_on;
9494
pub use reactor::{Readable, ReadableOwned, Writable, WritableOwned};
9595

96-
/// Use `Duration::MAX` once `duration_constants` are stabilized.
97-
fn duration_max() -> Duration {
98-
Duration::new(std::u64::MAX, 1_000_000_000 - 1)
99-
}
100-
10196
/// A future or stream that emits timed events.
10297
///
10398
/// Timers are futures that output a single [`Instant`] when they fire.
@@ -195,7 +190,7 @@ impl Timer {
195190
Timer {
196191
id_and_waker: None,
197192
when: None,
198-
period: duration_max(),
193+
period: Duration::MAX,
199194
}
200195
}
201196

@@ -232,8 +227,7 @@ impl Timer {
232227
/// # });
233228
/// ```
234229
pub fn at(instant: Instant) -> Timer {
235-
// Use Duration::MAX once duration_constants are stabilized.
236-
Timer::interval_at(instant, duration_max())
230+
Timer::interval_at(instant, Duration::MAX)
237231
}
238232

239233
/// Creates a timer that emits events periodically.

0 commit comments

Comments
 (0)