diff options
| author | Andrew Paseltiner <apaseltiner@gmail.com> | 2013-03-22 16:09:20 -0400 |
|---|---|---|
| committer | Andrew Paseltiner <apaseltiner@gmail.com> | 2013-03-23 06:57:30 -0400 |
| commit | 45677eebf286a39c29d9cd789e76ea1cf2d2b1d0 (patch) | |
| tree | 04b5fbbe19377386b540c192fba0568463da46c1 /src/libstd/time.rs | |
| parent | 2b83defa4a48303db642f38e2a9f24460756721d (diff) | |
| download | rust-45677eebf286a39c29d9cd789e76ea1cf2d2b1d0.tar.gz rust-45677eebf286a39c29d9cd789e76ea1cf2d2b1d0.zip | |
replace impls with `deriving` where applicable
Diffstat (limited to 'src/libstd/time.rs')
| -rw-r--r-- | src/libstd/time.rs | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/src/libstd/time.rs b/src/libstd/time.rs index ce153c1ac24..9ac302ed890 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -40,6 +40,7 @@ pub mod rustrt { /// A record specifying a time value in seconds and nanoseconds. #[auto_encode] #[auto_decode] +#[deriving(Eq)] pub struct Timespec { sec: i64, nsec: i32 } /* @@ -57,13 +58,6 @@ pub impl Timespec { } } -impl Eq for Timespec { - fn eq(&self, other: &Timespec) -> bool { - self.sec == other.sec && self.nsec == other.nsec - } - fn ne(&self, other: &Timespec) -> bool { !self.eq(other) } -} - impl Ord for Timespec { fn lt(&self, other: &Timespec) -> bool { self.sec < other.sec || @@ -117,6 +111,7 @@ pub fn tzset() { #[auto_encode] #[auto_decode] +#[deriving(Eq)] pub struct Tm { tm_sec: i32, // seconds after the minute ~[0-60] tm_min: i32, // minutes after the hour ~[0-59] @@ -132,24 +127,6 @@ pub struct Tm { tm_nsec: i32, // nanoseconds } -impl Eq for Tm { - fn eq(&self, other: &Tm) -> bool { - self.tm_sec == (*other).tm_sec && - self.tm_min == (*other).tm_min && - self.tm_hour == (*other).tm_hour && - self.tm_mday == (*other).tm_mday && - self.tm_mon == (*other).tm_mon && - self.tm_year == (*other).tm_year && - self.tm_wday == (*other).tm_wday && - self.tm_yday == (*other).tm_yday && - self.tm_isdst == (*other).tm_isdst && - self.tm_gmtoff == (*other).tm_gmtoff && - self.tm_zone == (*other).tm_zone && - self.tm_nsec == (*other).tm_nsec - } - fn ne(&self, other: &Tm) -> bool { !self.eq(other) } -} - pub fn empty_tm() -> Tm { Tm { tm_sec: 0_i32, |
