Skip to content
Snippets Groups Projects

Duration from time

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Joel Messerli
    test.rs 245 B
    
    fn main() {
        let midnight = NaiveTime::from_num_seconds_from_midnight(0,0);
        let time = NaiveTime::parse_from_str("00:15:00", "%H:%M:%S").unwrap();
        let duration = time.signed_duration_since(midnight);
    
        println!("{}", duration);
    }
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment