X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=backend%2Fsrc%2Fvalheim_controller.rs;h=3d990331bbd0d5487cacff78e51137d32ebae39f;hb=9deef63b608b62780a4dfed031410c25e10e477a;hp=3c2bab6e35d6a34a08629e33fa49b067fa5957bb;hpb=f5ee5c4f340df1843e82b54e8a8835981aef6aa0;p=valheim_web.git diff --git a/backend/src/valheim_controller.rs b/backend/src/valheim_controller.rs index 3c2bab6..3d99033 100644 --- a/backend/src/valheim_controller.rs +++ b/backend/src/valheim_controller.rs @@ -1,4 +1,5 @@ use sysinfo::{ ProcessExt, SystemExt }; +use chrono::{ DateTime, Datelike, Timelike, Utc }; #[cfg(target_os = "unix")] use systemd::journal; @@ -10,6 +11,7 @@ pub struct ValheimExe { uptime: u64, // [s]. world_size: u64, // [B]. nb_of_players: u32, + last_backup: DateTime, } impl ValheimExe { @@ -35,6 +37,10 @@ impl ValheimExe { pub fn get_nb_of_player(&self) -> u32 { self.nb_of_players } + + pub fn format_last_backup(&self) -> String { + string::from("") + } } const BINARY_PREFIXES: [&str; 8] = ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB"]; @@ -90,7 +96,11 @@ fn get_number_of_players() -> u32 { 0 } -pub fn get_valheim_executable_information(world_path : &str) -> Option { +fn get_last_backup_datetime(backup_path: &str) -> DateTime { + +} + +pub fn get_valheim_executable_information(world_path: &str, backup_path: &str) -> Option { let mut system = sysinfo::System::new_all(); system.refresh_system(); let processes = system.get_process_by_name(VALHEIM_PROCESS_NAME); @@ -106,7 +116,8 @@ pub fn get_valheim_executable_information(world_path : &str) -> Option