RosettaCodeData/Task/File-modification-time/Rust/file-modification-time.rust

13 lines
255 B
Plaintext

use std::fs;
fn main() -> std::io::Result<()> {
let metadata = fs::metadata("foo.txt")?;
if let Ok(time) = metadata.accessed() {
println!("{:?}", time);
} else {
println!("Not supported on this platform");
}
Ok(())
}