src/bin/proxmox-backup-client.rs: use chrono::DateTime

This commit is contained in:
Dietmar Maurer 2019-03-01 06:59:32 +01:00
parent 51144821f9
commit 5a2892f0ae

View File

@ -2,7 +2,7 @@ extern crate proxmox_backup;
use failure::*; use failure::*;
//use std::os::unix::io::AsRawFd; //use std::os::unix::io::AsRawFd;
use chrono::{Local, TimeZone}; use chrono::{DateTime, Local, Utc, TimeZone};
use proxmox_backup::tools; use proxmox_backup::tools;
use proxmox_backup::cli::*; use proxmox_backup::cli::*;
@ -31,7 +31,7 @@ fn backup_directory(
repo: &BackupRepository, repo: &BackupRepository,
body: Body, body: Body,
archive_name: &str, archive_name: &str,
backup_time: u64, backup_time: DateTime<Utc>,
chunk_size: Option<u64>, chunk_size: Option<u64>,
) -> Result<(), Error> { ) -> Result<(), Error> {
@ -41,7 +41,7 @@ fn backup_directory(
.append_pair("archive_name", archive_name) .append_pair("archive_name", archive_name)
.append_pair("type", "host") .append_pair("type", "host")
.append_pair("id", &tools::nodename()) .append_pair("id", &tools::nodename())
.append_pair("time", &backup_time.to_string()); .append_pair("time", &backup_time.timestamp().to_string());
if let Some(size) = chunk_size { if let Some(size) = chunk_size {
query.append_pair("chunk-size", &size.to_string()); query.append_pair("chunk-size", &size.to_string());
@ -196,8 +196,7 @@ fn create_backup(
} }
} }
let backup_time = std::time::SystemTime::now().duration_since( let backup_time = Utc::now();
std::time::SystemTime::UNIX_EPOCH)?.as_secs();
let mut client = HttpClient::new(&repo.host, &repo.user); let mut client = HttpClient::new(&repo.host, &repo.user);