Skip to content

Commit a051b0c

Browse files
committed
---
yaml --- r: 128213 b: refs/heads/try c: 500b600 h: refs/heads/master i: 128211: bcef2fe v: v3
1 parent 7847588 commit a051b0c

File tree

2 files changed

+1
-38
lines changed

2 files changed

+1
-38
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: c6b02f65589cd3d1e94fd585ad93a5e720789d5a
5+
refs/heads/try: 500b600362b4e119dd1725fd99db745341459f82
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

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

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,6 @@ pub static MAX: Duration = Duration { days: MAX_DAYS, secs: SECS_PER_DAY as u32
5050
nanos: NANOS_PER_SEC as u32 - 1 };
5151

5252
impl Duration {
53-
/// Makes a new `Duration` with given number of days, seconds and nanoseconds.
54-
///
55-
/// Fails when the duration is out of bounds.
56-
#[inline]
57-
pub fn new(days: i32, secs: i32, nanos: i32) -> Duration {
58-
Duration::new_opt(days, secs, nanos).expect("Duration::new out of bounds")
59-
}
60-
61-
/// Makes a new `Duration` with given number of days, seconds and nanoseconds.
62-
///
63-
/// Returns `None` when the duration is out of bounds.
64-
pub fn new_opt(days: i32, secs: i32, nanos: i32) -> Option<Duration> {
65-
let (secs_, nanos) = div_mod_floor(nanos, NANOS_PER_SEC);
66-
let secs = try_opt!(secs.checked_add(&secs_));
67-
let (days_, secs) = div_mod_floor(secs, SECS_PER_DAY);
68-
let days = try_opt!(days.checked_add(&days_).and_then(|v| v.to_i32()));
69-
Some(Duration { days: days, secs: secs as u32, nanos: nanos as u32 })
70-
}
71-
7253
/// Makes a new `Duration` with given number of weeks.
7354
/// Equivalent to `Duration::new(weeks * 7, 0, 0)` with overflow checks.
7455
///
@@ -138,14 +119,6 @@ impl Duration {
138119
Duration { nanos: nanos as u32, ..Duration::seconds(secs) }
139120
}
140121

141-
/// Returns a tuple of the number of days, (non-leap) seconds and nanoseconds in the duration.
142-
/// Note that the number of seconds and nanoseconds are always positive,
143-
/// so that for example `-Duration::seconds(3)` has -1 days and 86,397 seconds.
144-
#[inline]
145-
pub fn to_tuple(&self) -> (i32, u32, u32) {
146-
(self.days, self.secs, self.nanos)
147-
}
148-
149122
/// Same as `to_tuple` but returns a tuple compatible to `to_negated_tuple`.
150123
#[inline]
151124
fn to_tuple_64(&self) -> (i64, u32, u32) {
@@ -514,8 +487,6 @@ mod tests {
514487
assert_eq!(Duration::seconds(86401).num_days(), 1);
515488
assert_eq!(Duration::seconds(-86399).num_days(), 0);
516489
assert_eq!(Duration::seconds(-86401).num_days(), -1);
517-
assert_eq!(Duration::new(1, 2, 3_004_005).num_days(), 1);
518-
assert_eq!(Duration::new(-1, -2, -3_004_005).num_days(), -1);
519490
assert_eq!(Duration::days(i32::MAX).num_days(), i32::MAX);
520491
assert_eq!(Duration::days(i32::MIN).num_days(), i32::MIN);
521492
assert_eq!(MAX.num_days(), MAX_DAYS);
@@ -532,8 +503,6 @@ mod tests {
532503
assert_eq!(Duration::milliseconds(1001).num_seconds(), 1);
533504
assert_eq!(Duration::milliseconds(-999).num_seconds(), 0);
534505
assert_eq!(Duration::milliseconds(-1001).num_seconds(), -1);
535-
assert_eq!(Duration::new(1, 2, 3_004_005).num_seconds(), 86402);
536-
assert_eq!(Duration::new(-1, -2, -3_004_005).num_seconds(), -86402);
537506
assert_eq!(Duration::seconds(i32::MAX).num_seconds(), i32::MAX as i64);
538507
assert_eq!(Duration::seconds(i32::MIN).num_seconds(), i32::MIN as i64);
539508
assert_eq!(MAX.num_seconds(), (MAX_DAYS as i64 + 1) * 86400 - 1);
@@ -550,8 +519,6 @@ mod tests {
550519
assert_eq!(Duration::microseconds(1001).num_milliseconds(), 1);
551520
assert_eq!(Duration::microseconds(-999).num_milliseconds(), 0);
552521
assert_eq!(Duration::microseconds(-1001).num_milliseconds(), -1);
553-
assert_eq!(Duration::new(1, 2, 3_004_005).num_milliseconds(), 86402_003);
554-
assert_eq!(Duration::new(-1, -2, -3_004_005).num_milliseconds(), -86402_003);
555522
assert_eq!(Duration::milliseconds(i32::MAX).num_milliseconds(), i32::MAX as i64);
556523
assert_eq!(Duration::milliseconds(i32::MIN).num_milliseconds(), i32::MIN as i64);
557524
assert_eq!(MAX.num_milliseconds(), (MAX_DAYS as i64 + 1) * 86400_000 - 1);
@@ -568,8 +535,6 @@ mod tests {
568535
assert_eq!(Duration::nanoseconds(1001).num_microseconds(), Some(1));
569536
assert_eq!(Duration::nanoseconds(-999).num_microseconds(), Some(0));
570537
assert_eq!(Duration::nanoseconds(-1001).num_microseconds(), Some(-1));
571-
assert_eq!(Duration::new(1, 2, 3_004_005).num_microseconds(), Some(86402_003_004));
572-
assert_eq!(Duration::new(-1, -2, -3_004_005).num_microseconds(), Some(-86402_003_004));
573538
assert_eq!(Duration::microseconds(i32::MAX).num_microseconds(), Some(i32::MAX as i64));
574539
assert_eq!(Duration::microseconds(i32::MIN).num_microseconds(), Some(i32::MIN as i64));
575540
assert_eq!(MAX.num_microseconds(), None);
@@ -591,8 +556,6 @@ mod tests {
591556
assert_eq!(d.num_nanoseconds(), Some(0));
592557
assert_eq!(Duration::nanoseconds(1).num_nanoseconds(), Some(1));
593558
assert_eq!(Duration::nanoseconds(-1).num_nanoseconds(), Some(-1));
594-
assert_eq!(Duration::new(1, 2, 3_004_005).num_nanoseconds(), Some(86402_003_004_005));
595-
assert_eq!(Duration::new(-1, -2, -3_004_005).num_nanoseconds(), Some(-86402_003_004_005));
596559
assert_eq!(Duration::nanoseconds(i32::MAX).num_nanoseconds(), Some(i32::MAX as i64));
597560
assert_eq!(Duration::nanoseconds(i32::MIN).num_nanoseconds(), Some(i32::MIN as i64));
598561
assert_eq!(MAX.num_nanoseconds(), None);

0 commit comments

Comments
 (0)