src/backup/datastore.rs: use DateTime<Utc> instead of unix epoch
This commit is contained in:
parent
f13c36c856
commit
541b908ea4
@ -81,7 +81,8 @@ fn upload_catar(
|
|||||||
|
|
||||||
let datastore = DataStore::lookup_datastore(store)?;
|
let datastore = DataStore::lookup_datastore(store)?;
|
||||||
|
|
||||||
let (mut path, _new) = datastore.create_backup_dir(backup_type, backup_id, backup_time)?;
|
let (mut path, _new) = datastore.create_backup_dir(
|
||||||
|
backup_type, backup_id, Utc.timestamp(backup_time, 0))?;
|
||||||
|
|
||||||
path.push(archive_name);
|
path.push(archive_name);
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ impl DataStore {
|
|||||||
&self,
|
&self,
|
||||||
backup_type: &str,
|
backup_type: &str,
|
||||||
backup_id: &str,
|
backup_id: &str,
|
||||||
backup_time: i64,
|
backup_time: DateTime<Utc>,
|
||||||
) -> Result<(PathBuf, bool), io::Error> {
|
) -> Result<(PathBuf, bool), io::Error> {
|
||||||
let mut relative_path = PathBuf::new();
|
let mut relative_path = PathBuf::new();
|
||||||
|
|
||||||
@ -208,8 +208,7 @@ impl DataStore {
|
|||||||
full_path.push(&relative_path);
|
full_path.push(&relative_path);
|
||||||
std::fs::create_dir_all(&full_path)?;
|
std::fs::create_dir_all(&full_path)?;
|
||||||
|
|
||||||
let dt = Utc.timestamp(backup_time, 0);
|
let date_str = backup_time.format("%Y-%m-%dT%H:%M:%S").to_string();
|
||||||
let date_str = dt.format("%Y-%m-%dT%H:%M:%S").to_string();
|
|
||||||
|
|
||||||
println!("date: {}", date_str);
|
println!("date: {}", date_str);
|
||||||
relative_path.push(&date_str);
|
relative_path.push(&date_str);
|
||||||
|
Loading…
Reference in New Issue
Block a user