From 703a25e8beb36e4546d588808a3f11d59f7c80bd Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Fri, 9 Jun 2023 10:42:17 +0200 Subject: [PATCH] refactor: use utc time --- src/server/backups.rs | 4 ++-- src/server/process.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/server/backups.rs b/src/server/backups.rs index e5fd4de..d567f42 100644 --- a/src/server/backups.rs +++ b/src/server/backups.rs @@ -17,7 +17,7 @@ pub struct BackupManager { config_dir: PathBuf, world_dir: PathBuf, max_backups: u64, - start_time: Option>, + start_time: Option>, 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)); diff --git a/src/server/process.rs b/src/server/process.rs index f503c84..7555aa3 100644 --- a/src/server/process.rs +++ b/src/server/process.rs @@ -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,