Skip to content

Commit b8797ce

Browse files
committed
---
yaml --- r: 154311 b: refs/heads/try2 c: c6b02f6 h: refs/heads/master i: 154309: bdcbac0 154307: a7b8fbc 154303: b8825cf v: v3
1 parent 59c050b commit b8797ce

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: ee10f3501c1df04a015a5331c8343792e519c7a7
8+
refs/heads/try2: c6b02f65589cd3d1e94fd585ad93a5e720789d5a
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libstd/time/duration.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ macro_rules! try_opt(
3939
#[deriving(PartialEq, Eq, PartialOrd, Ord)]
4040
pub struct Duration {
4141
days: i32,
42-
secs: u32,
43-
nanos: u32,
42+
secs: u32, // Always < SECS_PER_DAY
43+
nanos: u32, // Always < NANOS_PR_SECOND
4444
}
4545

4646
/// The minimum possible `Duration`.
@@ -81,18 +81,13 @@ impl Duration {
8181

8282
/// Makes a new `Duration` with given number of days.
8383
/// Equivalent to `Duration::new(days, 0, 0)`.
84-
///
85-
/// Fails when the duration is out of bounds.
8684
#[inline]
8785
pub fn days(days: i32) -> Duration {
88-
let days = days.to_i32().expect("Duration::days out of bounds");
8986
Duration { days: days, secs: 0, nanos: 0 }
9087
}
9188

9289
/// Makes a new `Duration` with given number of hours.
9390
/// Equivalent to `Duration::new(0, hours * 3600, 0)` with overflow checks.
94-
///
95-
/// Fails when the duration is out of bounds.
9691
#[inline]
9792
pub fn hours(hours: i32) -> Duration {
9893
let (days, hours) = div_mod_floor(hours, (SECS_PER_DAY / 3600));
@@ -102,8 +97,6 @@ impl Duration {
10297

10398
/// Makes a new `Duration` with given number of minutes.
10499
/// Equivalent to `Duration::new(0, mins * 60, 0)` with overflow checks.
105-
///
106-
/// Fails when the duration is out of bounds.
107100
#[inline]
108101
pub fn minutes(mins: i32) -> Duration {
109102
let (days, mins) = div_mod_floor(mins, (SECS_PER_DAY / 60));
@@ -113,8 +106,6 @@ impl Duration {
113106

114107
/// Makes a new `Duration` with given number of seconds.
115108
/// Equivalent to `Duration::new(0, secs, 0)`.
116-
///
117-
/// Fails when the duration is out of bounds.
118109
#[inline]
119110
pub fn seconds(secs: i32) -> Duration {
120111
let (days, secs) = div_mod_floor(secs, SECS_PER_DAY);
@@ -123,8 +114,6 @@ impl Duration {
123114

124115
/// Makes a new `Duration` with given number of milliseconds.
125116
/// Equivalent to `Duration::new(0, 0, millis * 1_000_000)` with overflow checks.
126-
///
127-
/// Fails when the duration is out of bounds.
128117
#[inline]
129118
pub fn milliseconds(millis: i32) -> Duration {
130119
let (secs, millis) = div_mod_floor(millis, (NANOS_PER_SEC / 1_000_000));
@@ -134,8 +123,6 @@ impl Duration {
134123

135124
/// Makes a new `Duration` with given number of microseconds.
136125
/// Equivalent to `Duration::new(0, 0, micros * 1_000)` with overflow checks.
137-
///
138-
/// Fails when the duration is out of bounds.
139126
#[inline]
140127
pub fn microseconds(micros: i32) -> Duration {
141128
let (secs, micros) = div_mod_floor(micros, (NANOS_PER_SEC / 1_000));
@@ -145,8 +132,6 @@ impl Duration {
145132

146133
/// Makes a new `Duration` with given number of nanoseconds.
147134
/// Equivalent to `Duration::new(0, 0, nanos)`.
148-
///
149-
/// Fails when the duration is out of bounds.
150135
#[inline]
151136
pub fn nanoseconds(nanos: i32) -> Duration {
152137
let (secs, nanos) = div_mod_floor(nanos, NANOS_PER_SEC);

0 commit comments

Comments
 (0)