refactor: use utc time

incremental-backups
Jef Roosens 2023-06-09 10:42:17 +02:00 committed by Chewing_Bever
parent 29d6713486
commit 703a25e8be
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
2 changed files with 4 additions and 4 deletions

View File

@ -17,7 +17,7 @@ pub struct BackupManager {
config_dir: PathBuf,
world_dir: PathBuf,
max_backups: u64,
start_time: Option<chrono::DateTime<chrono::Local>>,
start_time: Option<chrono::DateTime<chrono::Utc>>,
files: Vec<(PathBuf, PathBuf)>
}
@ -69,7 +69,7 @@ impl BackupManager {
}
pub fn create_archive(&mut self) -> io::Result<()> {
let start_time = chrono::offset::Local::now();
let start_time = chrono::offset::Utc::now();
self.start_time = Some(start_time);
let filename = format!("{}", start_time.format(FILENAME_FORMAT));

View File

@ -88,7 +88,7 @@ impl ServerProcess {
// We wait some time to (hopefully) ensure the save-all call has completed
std::thread::sleep(std::time::Duration::from_secs(10));
let start_time = chrono::offset::Local::now();
let start_time = chrono::offset::Utc::now();
let res = self.backups.create_archive();
if res.is_ok() {
@ -98,7 +98,7 @@ impl ServerProcess {
// The server's save feature needs to be enabled again even if the archive failed to create
self.custom("save-on")?;
let duration = chrono::offset::Local::now() - start_time;
let duration = chrono::offset::Utc::now() - start_time;
let duration_str = format!(
"{}m{}s",
duration.num_seconds() / 60,