我正在使用chrono crate 并想计算Duration
两个DateTime
s 之间的值。
use chrono::Utc;
use chrono::offset::TimeZone;
let start_of_period = Utc.ymd(2020, 1, 1).and_hms(0, 0, 0);
let end_of_period = Utc.ymd(2021, 1, 1).and_hms(0, 0, 0);
// What should I enter here?
//
// The goal is to find a duration so that
// start_of_period + duration == end_of_period
// I expect duration to be of type std::time
let duration = ...
let nb_of_days = duration.num_days();