has 2 NaiveDateTime object* in memory,1 is in the future and another is current time.
find the difference in time as second unit into u64.
After hours of research ,trial and error below is the partial* working code I have.It only does get the time difference but it seems to ignore the date,and also seems to be going negative?
//where the date_only and alarm_time is parsed from std::env::args
let mut trgtdt = NaiveDateTime::new(date_only,alarm_time);
sleep_seconds = (trgtdt-chrono::offset::Local::now().naive_local()).num_seconds();
return sleep_seconds as u64;
What do you mean, exactly? The documentation of NaiveDateTime::sub()explicitly mentions that it's implemented in terms of signed_duration_since(). Hence, it's simply not possible that my solution doesn't give the same result as signed_duration_since().