1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2025-06-17 00:07:35 +02:00
Files
.github
dev
exercises
00_intro
01_variables
02_functions
03_if
04_primitive_types
05_vecs
06_move_semantics
07_structs
08_enums
09_strings
10_modules
README.md
modules1.rs
modules2.rs
modules3.rs
11_hashmaps
12_options
13_error_handling
14_generics
15_traits
16_lifetimes
17_tests
18_iterators
19_smart_pointers
20_threads
21_macros
22_clippy
23_conversions
quizzes
README.md
rustlings-macros
solutions
src
tests
.editorconfig
.gitignore
.markdownlint.yml
.typos.toml
CHANGELOG.md
CONTRIBUTING.md
Cargo.lock
Cargo.toml
LICENSE
README.md
THIRD_PARTY_EXERCISES.md
build.rs
clippy.toml
oranda.json
release-hook.sh
rustlings/exercises/10_modules/modules3.rs

14 lines
524 B
Rust
Raw Normal View History

2024-06-22 13:35:54 +02:00
// You can use the `use` keyword to bring module paths from modules from
// anywhere and especially from the standard library into your scope.
2024-06-22 13:35:54 +02:00
// 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 ???;
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!"),
}
}