diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-12-17 23:02:47 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-12-19 08:58:10 -0800 |
| commit | 84086c464f537591f0e4629676b3fc75517492ab (patch) | |
| tree | 7226ef61282962ff5be4772db3b1e849d6ba5cbe /src/libtime | |
| parent | bd90b936d73c0ea2c261cd8e7b9c43764cb2da05 (diff) | |
| download | rust-84086c464f537591f0e4629676b3fc75517492ab.tar.gz rust-84086c464f537591f0e4629676b3fc75517492ab.zip | |
Register new snapshots
This does not yet start the movement to rustc-serialize. That detail is left to a future PR.
Diffstat (limited to 'src/libtime')
| -rw-r--r-- | src/libtime/lib.rs | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/src/libtime/lib.rs b/src/libtime/lib.rs index 4129086e9ec..bbeddcd263b 100644 --- a/src/libtime/lib.rs +++ b/src/libtime/lib.rs @@ -99,29 +99,6 @@ impl Timespec { } } -// NOTE(stage0): Remove impl after a snapshot -#[cfg(stage0)] -impl Add<Duration, Timespec> for Timespec { - fn add(&self, other: &Duration) -> Timespec { - let d_sec = other.num_seconds(); - // It is safe to unwrap the nanoseconds, because there cannot be - // more than one second left, which fits in i64 and in i32. - let d_nsec = (*other - Duration::seconds(d_sec)) - .num_nanoseconds().unwrap() as i32; - let mut sec = self.sec + d_sec; - let mut nsec = self.nsec + d_nsec; - if nsec >= NSEC_PER_SEC { - nsec -= NSEC_PER_SEC; - sec += 1; - } else if nsec < 0 { - nsec += NSEC_PER_SEC; - sec -= 1; - } - Timespec::new(sec, nsec) - } -} - -#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot impl Add<Duration, Timespec> for Timespec { fn add(self, other: Duration) -> Timespec { let d_sec = other.num_seconds(); @@ -142,17 +119,6 @@ impl Add<Duration, Timespec> for Timespec { } } -// NOTE(stage0): Remove impl after a snapshot -#[cfg(stage0)] -impl Sub<Timespec, Duration> for Timespec { - fn sub(&self, other: &Timespec) -> Duration { - let sec = self.sec - other.sec; - let nsec = self.nsec - other.nsec; - Duration::seconds(sec) + Duration::nanoseconds(nsec as i64) - } -} - -#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot impl Sub<Timespec, Duration> for Timespec { fn sub(self, other: Timespec) -> Duration { let sec = self.sec - other.sec; |
