6: Add solution to Rust track exercise "Gigasecond".

[?]
9Zb2bmkejrNknawUtr3MKvVstZkVDR8x8ritfgZXKrky
Dec 23, 2021, 5:17 PM
24GGBHIIHWNRB6TYMGSKKB4MEMU2GDZDMYPFPK5NME7TGRSLVLAAC

Dependencies

  • [2] FEICPMFG 5: Add Rust track exercise "Gigasecond".

Change contents

  • replacement in rust/gigasecond/tests/gigasecond.rs at line 7
    [2.309][2.309:337]()
    use time::{Date, Time};
    [2.309]
    [2.337]
    use time::{Date, Time};
  • replacement in rust/gigasecond/tests/gigasecond.rs at line 9
    [2.338][2.338:499]()
    DateTime::new(
    Date::from_calendar_date(year, month.try_into().unwrap(), day).unwrap(),
    Time::from_hms(hour, minute, second).unwrap(),
    )
    [2.338]
    [2.499]
    DateTime::new(
    Date::from_calendar_date(year, month.try_into().unwrap(), day).unwrap(),
    Time::from_hms(hour, minute, second).unwrap(),
    )
  • replacement in rust/gigasecond/tests/gigasecond.rs at line 17
    [2.527][2.527:574]()
    let start_date = dt(2011, 4, 25, 0, 0, 0);
    [2.527]
    [2.574]
    let start_date = dt(2011, 4, 25, 0, 0, 0);
  • replacement in rust/gigasecond/tests/gigasecond.rs at line 19
    [2.575][2.575:649]()
    assert_eq!(gigasecond::after(start_date), dt(2043, 1, 1, 1, 46, 40));
    [2.575]
    [2.649]
    assert_eq!(gigasecond::after(start_date), dt(2043, 1, 1, 1, 46, 40));
  • replacement in rust/gigasecond/tests/gigasecond.rs at line 25
    [2.695][2.695:742]()
    let start_date = dt(1977, 6, 13, 0, 0, 0);
    [2.695]
    [2.742]
    let start_date = dt(1977, 6, 13, 0, 0, 0);
  • replacement in rust/gigasecond/tests/gigasecond.rs at line 27
    [2.743][2.743:818]()
    assert_eq!(gigasecond::after(start_date), dt(2009, 2, 19, 1, 46, 40));
    [2.743]
    [2.818]
    assert_eq!(gigasecond::after(start_date), dt(2009, 2, 19, 1, 46, 40));
  • replacement in rust/gigasecond/tests/gigasecond.rs at line 33
    [2.862][2.862:909]()
    let start_date = dt(1959, 7, 19, 0, 0, 0);
    [2.862]
    [2.909]
    let start_date = dt(1959, 7, 19, 0, 0, 0);
  • replacement in rust/gigasecond/tests/gigasecond.rs at line 35
    [2.910][2.910:985]()
    assert_eq!(gigasecond::after(start_date), dt(1991, 3, 27, 1, 46, 40));
    [2.910]
    [2.985]
    assert_eq!(gigasecond::after(start_date), dt(1991, 3, 27, 1, 46, 40));
  • replacement in rust/gigasecond/tests/gigasecond.rs at line 41
    [2.1027][2.1027:1075]()
    let start_date = dt(2015, 1, 24, 22, 0, 0);
    [2.1027]
    [2.1075]
    let start_date = dt(2015, 1, 24, 22, 0, 0);
  • replacement in rust/gigasecond/tests/gigasecond.rs at line 43
    [2.1076][2.1076:1152]()
    assert_eq!(gigasecond::after(start_date), dt(2046, 10, 2, 23, 46, 40));
    [2.1076]
    [2.1152]
    assert_eq!(gigasecond::after(start_date), dt(2046, 10, 2, 23, 46, 40));
  • replacement in rust/gigasecond/tests/gigasecond.rs at line 49
    [2.1202][2.1202:1252]()
    let start_date = dt(2015, 1, 24, 23, 59, 59);
    [2.1202]
    [2.1252]
    let start_date = dt(2015, 1, 24, 23, 59, 59);
  • replacement in rust/gigasecond/tests/gigasecond.rs at line 51
    [2.1253][2.1253:1328]()
    assert_eq!(gigasecond::after(start_date), dt(2046, 10, 3, 1, 46, 39));
    [2.1253]
    [2.1328]
    assert_eq!(gigasecond::after(start_date), dt(2046, 10, 3, 1, 46, 39));
  • replacement in rust/gigasecond/src/lib.rs at line 1
    [2.1379][2.1380:1421]()
    use time::PrimitiveDateTime as DateTime;
    [2.1379]
    [2.1421]
    use time::{Duration, PrimitiveDateTime as DateTime};
  • replacement in rust/gigasecond/src/lib.rs at line 5
    [2.1521][2.1521:1591]()
    unimplemented!("What time is a gigasecond later than {}", start);
    [2.1521]
    [2.1591]
    start + Duration::seconds(10_i64.pow(9))