mirror of
https://github.com/ArthurDanjou/rustlings.git
synced 2026-02-04 13:47:49 +01:00
- Created empty solution files for various exercises in strings, modules, hashmaps, options, error handling, generics, traits, lifetimes, tests, iterators, smart pointers, threads, macros, clippy, conversions, and quizzes. - Each solution file contains a main function with a comment indicating that it will be automatically filled after completing the exercise. - Added a README.md file to provide information about the solutions and their purpose.
14 lines
553 B
Rust
14 lines
553 B
Rust
// You can use the `use` keyword to bring module paths from modules from
|
|
// anywhere and especially from the standard library into your scope.
|
|
|
|
// TODO: Bring `SystemTime` and `UNIX_EPOCH` from the `std::time` module into
|
|
// your scope. Bonus style points if you can do it with one line!
|
|
use std::time::{SystemTime, UNIX_EPOCH};
|
|
|
|
fn main() {
|
|
match SystemTime::now().duration_since(UNIX_EPOCH) {
|
|
Ok(n) => println!("1970-01-01 00:00:00 UTC was {} seconds ago!", n.as_secs()),
|
|
Err(_) => panic!("SystemTime before UNIX EPOCH!"),
|
|
}
|
|
}
|