From 5516dc630d71315765fcf3fa561c9204e5092255 Mon Sep 17 00:00:00 2001 From: Kang Seonghoon Date: Wed, 2 Apr 2014 01:30:52 +0900 Subject: [PATCH] language changes: #[]; -> #![], priv fields by default; added .travis.yml. --- .travis.yml | 12 ++++++++++++ src/chrono/date.rs | 2 +- src/chrono/datetime.rs | 10 ++++++++++ src/chrono/duration.rs | 6 +++--- src/chrono/time.rs | 8 ++++---- 5 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d5bf616 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +before_install: + - yes | sudo add-apt-repository ppa:hansjorg/rust + - sudo apt-get update +install: + - sudo apt-get install rust-nightly +script: + - ./configure + - make check RUSTFLAGS= + - make doc +branches: + only: + - master diff --git a/src/chrono/date.rs b/src/chrono/date.rs index 6c3c51b..6065cc4 100644 --- a/src/chrono/date.rs +++ b/src/chrono/date.rs @@ -206,7 +206,7 @@ pub trait Datelike { /// Also supports the conversion from ISO 8601 ordinal and week date. #[deriving(Eq, TotalEq, Ord, TotalOrd, Hash)] pub struct DateZ { - priv ymdf: DateImpl, // (year << 13) | of + ymdf: DateImpl, // (year << 13) | of } impl DateZ { diff --git a/src/chrono/datetime.rs b/src/chrono/datetime.rs index a847ce8..44f79fe 100644 --- a/src/chrono/datetime.rs +++ b/src/chrono/datetime.rs @@ -46,6 +46,16 @@ impl DateTimeZ { } } + #[inline] + pub fn date(&self) -> DateZ { + self.date + } + + #[inline] + pub fn time(&self) -> TimeZ { + self.time + } + /// Returns the number of non-leap seconds since January 1, 1970 0:00:00. /// Note that this does *not* account for the timezone! #[inline] diff --git a/src/chrono/duration.rs b/src/chrono/duration.rs index bf755d9..fcf8f1f 100644 --- a/src/chrono/duration.rs +++ b/src/chrono/duration.rs @@ -10,9 +10,9 @@ static SECS_PER_DAY: int = 86400; #[deriving(Eq, TotalEq, Ord, TotalOrd)] pub struct Duration { - priv days: int, - priv secs: u32, - priv nanos: u32, + days: int, + secs: u32, + nanos: u32, } impl Duration { diff --git a/src/chrono/time.rs b/src/chrono/time.rs index 57ea56f..1c5cb08 100644 --- a/src/chrono/time.rs +++ b/src/chrono/time.rs @@ -61,10 +61,10 @@ pub trait Timelike { /// Allows for the nanosecond precision and optional leap second representation. #[deriving(Eq, TotalEq, Ord, TotalOrd, Hash)] pub struct TimeZ { - priv hour: u8, - priv min: u8, - priv sec: u8, - priv frac: u32, + hour: u8, + min: u8, + sec: u8, + frac: u32, } impl TimeZ {