rustlings

solving rustlings ft. dracuxan
git clone [email protected]:dracuxan/rustlings.git
Log | Files | Refs

modules3.rs (553B)


      1 // You can use the `use` keyword to bring module paths from modules from
      2 // anywhere and especially from the standard library into your scope.
      3 
      4 // TODO: Bring `SystemTime` and `UNIX_EPOCH` from the `std::time` module into
      5 // your scope. Bonus style points if you can do it with one line!
      6 use std::time::{SystemTime, UNIX_EPOCH};
      7 
      8 fn main() {
      9     match SystemTime::now().duration_since(UNIX_EPOCH) {
     10         Ok(n) => println!("1970-01-01 00:00:00 UTC was {} seconds ago!", n.as_secs()),
     11         Err(_) => panic!("SystemTime before UNIX EPOCH!"),
     12     }
     13 }