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

[?]
Aaw9nJhsNmfzFih9mKyNw9mV8CgERXJkRa1kK1Kx3LQH
Oct 10, 2021, 2:21 PM
KG7NGGS4TDAGDVHKJ4A5CHLRXQN2HBVZSDJNA7WIORMFRBX7YIRAC

Dependencies

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

Change contents

  • replacement in rust/gigasecond/tests/gigasecond.rs at line 5
    [2.135][2.135:195]()
    let start_date = Utc.ymd(2011, 4, 25).and_hms(0, 0, 0);
    [2.135]
    [2.195]
    let start_date = Utc.ymd(2011, 4, 25).and_hms(0, 0, 0);
  • replacement in rust/gigasecond/tests/gigasecond.rs at line 7
    [2.196][2.196:305]()
    assert_eq!(
    gigasecond::after(start_date),
    Utc.ymd(2043, 1, 1).and_hms(1, 46, 40)
    );
    [2.196]
    [2.305]
    assert_eq!(
    gigasecond::after(start_date),
    Utc.ymd(2043, 1, 1).and_hms(1, 46, 40)
    );
  • replacement in rust/gigasecond/tests/gigasecond.rs at line 16
    [2.351][2.351:411]()
    let start_date = Utc.ymd(1977, 6, 13).and_hms(0, 0, 0);
    [2.351]
    [2.411]
    let start_date = Utc.ymd(1977, 6, 13).and_hms(0, 0, 0);
  • replacement in rust/gigasecond/tests/gigasecond.rs at line 18
    [2.412][2.412:522]()
    assert_eq!(
    gigasecond::after(start_date),
    Utc.ymd(2009, 2, 19).and_hms(1, 46, 40)
    );
    [2.412]
    [2.522]
    assert_eq!(
    gigasecond::after(start_date),
    Utc.ymd(2009, 2, 19).and_hms(1, 46, 40)
    );
  • replacement in rust/gigasecond/tests/gigasecond.rs at line 27
    [2.566][2.566:626]()
    let start_date = Utc.ymd(1959, 7, 19).and_hms(0, 0, 0);
    [2.566]
    [2.626]
    let start_date = Utc.ymd(1959, 7, 19).and_hms(0, 0, 0);
  • replacement in rust/gigasecond/tests/gigasecond.rs at line 29
    [2.627][2.627:737]()
    assert_eq!(
    gigasecond::after(start_date),
    Utc.ymd(1991, 3, 27).and_hms(1, 46, 40)
    );
    [2.627]
    [2.737]
    assert_eq!(
    gigasecond::after(start_date),
    Utc.ymd(1991, 3, 27).and_hms(1, 46, 40)
    );
  • replacement in rust/gigasecond/tests/gigasecond.rs at line 38
    [2.779][2.779:840]()
    let start_date = Utc.ymd(2015, 1, 24).and_hms(22, 0, 0);
    [2.779]
    [2.840]
    let start_date = Utc.ymd(2015, 1, 24).and_hms(22, 0, 0);
  • replacement in rust/gigasecond/tests/gigasecond.rs at line 40
    [2.841][2.841:952]()
    assert_eq!(
    gigasecond::after(start_date),
    Utc.ymd(2046, 10, 2).and_hms(23, 46, 40)
    );
    [2.841]
    [2.952]
    assert_eq!(
    gigasecond::after(start_date),
    Utc.ymd(2046, 10, 2).and_hms(23, 46, 40)
    );
  • replacement in rust/gigasecond/tests/gigasecond.rs at line 49
    [2.1002][2.1002:1065]()
    let start_date = Utc.ymd(2015, 1, 24).and_hms(23, 59, 59);
    [2.1002]
    [2.1065]
    let start_date = Utc.ymd(2015, 1, 24).and_hms(23, 59, 59);
  • replacement in rust/gigasecond/tests/gigasecond.rs at line 51
    [2.1066][2.1066:1176]()
    assert_eq!(
    gigasecond::after(start_date),
    Utc.ymd(2046, 10, 3).and_hms(1, 46, 39)
    );
    [2.1066]
    [2.1176]
    assert_eq!(
    gigasecond::after(start_date),
    Utc.ymd(2046, 10, 3).and_hms(1, 46, 39)
    );
  • replacement in rust/gigasecond/src/lib.rs at line 1
    [2.1226][2.1227:1256]()
    use chrono::{DateTime, Utc};
    [2.1226]
    [2.1256]
    use chrono::{DateTime, Duration, Utc};
  • replacement in rust/gigasecond/src/lib.rs at line 5
    [2.1370][2.1370:1440]()
    unimplemented!("What time is a gigasecond later than {}", start);
    [2.1370]
    [2.1440]
    start + Duration::seconds(10_i64.pow(9))