diff --git a/exercises/gigasecond/.meta/hints.md b/exercises/gigasecond/.meta/hints.md new file mode 100644 index 000000000..f8375dcdf --- /dev/null +++ b/exercises/gigasecond/.meta/hints.md @@ -0,0 +1 @@ +If you're unsure what operations you can perform on `DateTime` take a look at the [chrono crate](https://docs.rs/chrono/0.4.0/chrono/) which is listed as a dependency in the `Cargo.toml` file for this exercise. diff --git a/exercises/gigasecond/README.md b/exercises/gigasecond/README.md index 4d1b6fd8d..1c2e139be 100644 --- a/exercises/gigasecond/README.md +++ b/exercises/gigasecond/README.md @@ -4,6 +4,9 @@ Calculate the moment when someone has lived for 10^9 seconds. A gigasecond is 10^9 (1,000,000,000) seconds. +If you're unsure what operations you can perform on `DateTime` take a look at the [chrono crate](https://docs.rs/chrono/0.4.0/chrono/) which is listed as a dependency in the `Cargo.toml` file for this exercise. + + ## Rust Installation Refer to the [exercism help page][help-page] for Rust installation and learning diff --git a/exercises/gigasecond/example.rs b/exercises/gigasecond/example.rs index bda3cfe37..b343009b2 100644 --- a/exercises/gigasecond/example.rs +++ b/exercises/gigasecond/example.rs @@ -1,5 +1,5 @@ extern crate chrono; -use chrono::*; +use chrono::{DateTime, Duration, Utc}; pub fn after(start: DateTime) -> DateTime { start + Duration::seconds(1_000_000_000) diff --git a/exercises/gigasecond/src/lib.rs b/exercises/gigasecond/src/lib.rs index ed96ec688..fc2f2c180 100644 --- a/exercises/gigasecond/src/lib.rs +++ b/exercises/gigasecond/src/lib.rs @@ -1,7 +1,7 @@ -extern crate chrono; -use chrono::*; - -// Returns a Utc DateTime one billion seconds after start. -pub fn after(start: DateTime) -> DateTime { - unimplemented!() -} +extern crate chrono; +use chrono::{DateTime, Utc}; + +// Returns a Utc DateTime one billion seconds after start. +pub fn after(start: DateTime) -> DateTime { + unimplemented!("What time is a gigasecond later than {}", start); +} diff --git a/exercises/gigasecond/tests/gigasecond.rs b/exercises/gigasecond/tests/gigasecond.rs index ae2bf0b82..ad041c805 100644 --- a/exercises/gigasecond/tests/gigasecond.rs +++ b/exercises/gigasecond/tests/gigasecond.rs @@ -13,7 +13,7 @@ extern crate gigasecond; * In order to use the crate, your solution will need to start with the two following lines */ extern crate chrono; -use chrono::*; +use chrono::{TimeZone, Utc}; #[test] fn test_date() {