更名文件夹objects->models,并增添index.rs结构

This commit is contained in:
mrbeanc
2023-12-18 13:42:29 +08:00
parent f55ab0e7a6
commit af5e36c24c
10 changed files with 53 additions and 5 deletions

View File

@@ -34,6 +34,11 @@ pub fn get_storage_path() -> Result<String, std::io::Error> {
}
}
pub fn format_time(time: &std::time::SystemTime) -> String {
let datetime: chrono::DateTime<chrono::Utc> = time.clone().into();
datetime.format("%Y-%m-%d %H:%M:%S.%3f").to_string()
}
#[cfg(test)]
mod tests {
use super::*;
@@ -49,4 +54,11 @@ mod tests {
},
}
}
#[test]
fn test_format_time() {
let time = std::time::SystemTime::now();
let formatted_time = format_time(&time);
println!("{}", formatted_time);
}
}