We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 61fb065 commit 72da7fcCopy full SHA for 72da7fc
src/utils.rs
@@ -55,11 +55,12 @@ pub fn do_write_line(
55
pub fn get_modification_time(file_path: &str) -> String {
56
use chrono::{DateTime, Local};
57
use std::fs;
58
+ use std::time::SystemTime;
59
+
60
+ let modification_time: SystemTime = fs::metadata(file_path)
61
+ .and_then(|m| m.modified())
62
+ .unwrap_or(SystemTime::now());
63
- let metadata = fs::metadata(file_path).expect("Failed to get metadata");
- let modification_time = metadata
- .modified()
- .expect("Failed to get modification time");
64
let modification_time: DateTime<Local> = modification_time.into();
65
let modification_time: String = modification_time
66
.format("%Y-%m-%d %H:%M:%S%.9f %z")
0 commit comments