From 3586ece50a31fe0e27ca19849d2ffe7f856516d4 Mon Sep 17 00:00:00 2001 From: Avery Winters Date: Wed, 11 Oct 2023 11:06:56 -0500 Subject: [PATCH] Solve rust/gigasecond --- rust/gigasecond/src/lib.rs | 4 ++-- rust/gigasecond/tests/gigasecond.rs | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/rust/gigasecond/src/lib.rs b/rust/gigasecond/src/lib.rs index 2dbb9ab..b6ba450 100644 --- a/rust/gigasecond/src/lib.rs +++ b/rust/gigasecond/src/lib.rs @@ -1,6 +1,6 @@ -use time::PrimitiveDateTime as DateTime; +use time::{ext::NumericalDuration, PrimitiveDateTime as DateTime}; // Returns a DateTime one billion seconds after start. pub fn after(start: DateTime) -> DateTime { - todo!("What time is a gigasecond later than {start}"); + start + 1_000_000_000.seconds() } diff --git a/rust/gigasecond/tests/gigasecond.rs b/rust/gigasecond/tests/gigasecond.rs index 52237cf..a2b66c0 100644 --- a/rust/gigasecond/tests/gigasecond.rs +++ b/rust/gigasecond/tests/gigasecond.rs @@ -20,7 +20,6 @@ fn date() { } #[test] -#[ignore] fn another_date() { let start_date = dt(1977, 6, 13, 0, 0, 0); @@ -28,7 +27,6 @@ fn another_date() { } #[test] -#[ignore] fn third_date() { let start_date = dt(1959, 7, 19, 0, 0, 0); @@ -36,7 +34,6 @@ fn third_date() { } #[test] -#[ignore] fn datetime() { let start_date = dt(2015, 1, 24, 22, 0, 0); @@ -44,7 +41,6 @@ fn datetime() { } #[test] -#[ignore] fn another_datetime() { let start_date = dt(2015, 1, 24, 23, 59, 59);