refactor: use utc time
							parent
							
								
									29d6713486
								
							
						
					
					
						commit
						703a25e8be
					
				| 
						 | 
					@ -17,7 +17,7 @@ pub struct BackupManager {
 | 
				
			||||||
    config_dir: PathBuf,
 | 
					    config_dir: PathBuf,
 | 
				
			||||||
    world_dir: PathBuf,
 | 
					    world_dir: PathBuf,
 | 
				
			||||||
    max_backups: u64,
 | 
					    max_backups: u64,
 | 
				
			||||||
    start_time: Option<chrono::DateTime<chrono::Local>>,
 | 
					    start_time: Option<chrono::DateTime<chrono::Utc>>,
 | 
				
			||||||
    files: Vec<(PathBuf, PathBuf)>
 | 
					    files: Vec<(PathBuf, PathBuf)>
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -69,7 +69,7 @@ impl BackupManager {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pub fn create_archive(&mut self) -> io::Result<()> {
 | 
					    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);
 | 
					        self.start_time = Some(start_time);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        let filename = format!("{}", start_time.format(FILENAME_FORMAT));
 | 
					        let filename = format!("{}", start_time.format(FILENAME_FORMAT));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -88,7 +88,7 @@ impl ServerProcess {
 | 
				
			||||||
        // We wait some time to (hopefully) ensure the save-all call has completed
 | 
					        // We wait some time to (hopefully) ensure the save-all call has completed
 | 
				
			||||||
        std::thread::sleep(std::time::Duration::from_secs(10));
 | 
					        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();
 | 
					        let res = self.backups.create_archive();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if res.is_ok() {
 | 
					        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
 | 
					        // The server's save feature needs to be enabled again even if the archive failed to create
 | 
				
			||||||
        self.custom("save-on")?;
 | 
					        self.custom("save-on")?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        let duration = chrono::offset::Local::now() - start_time;
 | 
					        let duration = chrono::offset::Utc::now() - start_time;
 | 
				
			||||||
        let duration_str = format!(
 | 
					        let duration_str = format!(
 | 
				
			||||||
            "{}m{}s",
 | 
					            "{}m{}s",
 | 
				
			||||||
            duration.num_seconds() / 60,
 | 
					            duration.num_seconds() / 60,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue