Home

Published

- 1 min read

get current epoch time rust

img of get current epoch time rust

The solution for this is noted below

get current epoch time rust

Solution

   use std::time::{SystemTime, UNIX_EPOCH};

fn main() {
    let start = SystemTime::now();
    let since_the_epoch = start
        .duration_since(UNIX_EPOCH)
        .unwrap();
    println!("{:?}", since_the_epoch);
}

Try other methods by searching on the site. That is if this doesn’t work