Created
January 15, 2020 11:33
-
-
Save mykhailokrainik/b5e5673a1f061c3956746976ec153f67 to your computer and use it in GitHub Desktop.
Time since the epoch [Rust]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use time; | |
use std::time::{SystemTime, UNIX_EPOCH}; | |
fn main() { | |
let a = time::get_time().sec; | |
dbg!(&a); | |
let since_the_epoch = SystemTime::now().duration_since(UNIX_EPOCH) | |
.expect("Time went backwards").as_secs(); | |
println!("{:?}", since_the_epoch); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment