daily pastebin goal
68%
SHARE
TWEET

Untitled

a guest May 17th, 2018 104 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #![feature(assoc_unix_epoch)]
  2.  
  3. use std::fs::File;
  4. use std::time::SystemTime;
  5.  
  6. extern crate chrono;
  7.  
  8. fn main() {
  9.     let file = File::open("/dev/urandom").unwrap();
  10.     let metadata = file.metadata().unwrap();
  11.     let created = metadata.created().unwrap();
  12.     let date = created.duration_since(SystemTime::UNIX_EPOCH).unwrap();
  13.     use chrono::prelude::*;
  14.     let date = chrono::Duration::from_std(date);
  15.     println!("{:?}", date);
  16.    
  17. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top